Suppose I have the following table:
+----------+
| A | B |
+----------+
| 1 | 2 |
+----------+
I want to make so that when I hover over A that 1 gets certain css styles, ditto for B and 2. Is there a way to do this without using js?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
With this markup and pure CSS it’s not possible because you would need to use
td:hoverto apply the CSS rule on mouseover, and there is no selector that lets you travel up the DOM tree (which would be necessary as you want to target cells that live in a different branch from the one being hovered).If you can modify then a solution such as Dustin’s can work; if you can use JS then it’s also a matter of sprinkling a little jQuery on the table: