Jump to content

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.

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.