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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.