How can I tell the 2nd .yada to popup when the first .yada has focus?

How can I tell the 2nd .yada to popup when the 1st .yada has focus?

.yada:focus {

<p><a href=“#” class=“yada”></a></p>
<p><a href=“#” class=“yada”></a></p>

Hi Eric,

Untested, but maybe you can use the sibling selector.

p a.yada:focus + p a.yada {

Thanks Ray I’ll try that!

Well it didn’t work. You can’t seem target a sibling child like that.

However, if you can get your “a” out of that “p” tag it will work.

<html lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<style type="text/css">
body {
    background: #fff;
#wrap {
    margin:0 auto;
a {display:block}

a + a {
a:focus + a {

<div id="wrap">
    <a href="#" class="yada">yada</a>
    <a href="#" class="yada">yada</a>


Perfect! That seems to work well - thanks bro.

Oh the first one worked for me. I just ommitted the p in the css.

I highly doubt it, but is there anyway to target the .yada prior to the .yada with focus? So this one targets the one after…

.yada:focus + .yada {}

But can I target the .yada before (in the HTML) the one with focus?

But can I target the .yada before (in the HTML) the one with focus?

No, you can’t back up the html source like that.

Take that test code I posted (my last post) and show me what you did real quick.

I did it like this…

.yada:focus + .yada{

<p><a href=“#” class=“yada”></a></p>
<p><a href=“#” class=“yada”></a></p>

Ah, okay you had them AP’d.

That shouldn’t work :wink: and doesn’t seem to either :wink:

The other anchor isn’t adjacent and therefore cannot match. You can only match the ones under the same parent as per Rays example.

Safari is very buggy using pseudo classes on adjacent or sibling selectors and either won’t work at all or works bugilly,

Duh… I had my wires crossed again. To many things I’m working on - that set up was my other. Ray, Paul, your right. All my a’s (.yada’s) were in the same container (no p’s).

Not that I even need it (right now anyways), but there is no way (even with css3) to target the .yada in another container? Thanks!

Nope :). You can’t work your way back up the ancestry and then select an adjacent element.