-1

How to change the parent product bgcolor when hovering over the link or hovering over the details just using CSS?

HTML CODE

<div id="summary" align='center'>Products</div>
        <div id="detail" align='center'>
        <a href='http://www.3ds.com/products/catia/welcome/'>A</a></br>
        <a href='http://www.3ds.com/products/catia/welcome/'>B</a></br>

Thanks!

user1868185
  • 899
  • 3
  • 9
  • 24

1 Answers1

1

You can't do that through CSS only, as there is no parent selector.

However, using JavaScript, you could toggle the parent's class when the user hovers over the anchor element. At which point, you'll be able to style the class that gets added on hover.

Alex
  • 34,899
  • 5
  • 77
  • 90
  • then what can i use to do this? – user1868185 Mar 05 '13 at 03:49
  • JQuery has function .parent(). You can read more about it: http://api.jquery.com/parent/ In the end the function might be something along this line: `$('div.detail a').parent().css('background-color', 'red');` – Artur K. Mar 05 '13 at 03:52