Jump to content

Hovering one link, affecting another


D.Rattansingh

Recommended Posts

If we have 2 links t1 and t2 and I hover t2, is there any way to change the background of t1 with CSS or coud that only be done with javascript?

 

 

<div>

            <a href=# id="t1">   </a>

            <a href=# id="t2">   </a>

</div>

 

.t2:hover

{

                background-color: #CAFF70;

}

Link to comment
https://forums.phpfreaks.com/topic/251842-hovering-one-link-affecting-another/
Share on other sites

Sorry about that. The corrected code is:

 

<div>
            <a href=# id="t1">   </a>
            <a href=# id="t2">   </a>
</div>

#t2:hover
{
                background-color: blue;
}

 

These may not be the only anchors.

 

Yes if I do something like hover over t1, to change the background of t2. For e.g. the above would change the background of the link #t2. But what if I wanted to change the background of t1 instead?

 

I know this could be done with javascript but just wondering if it's possible with CSS.

 

DR.

<div id="hov">
            <a href=# id="t1">A really long link</a><br /><br />
            <a href=# id="t2">Another really long link</a>
</div>

#hov:hover  a
{
background-color: blue;
}

This will change both. You never answered if this is what you wanted.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.