0

Only using CSS2 i want to change background color of parent on mouse over of its child element can any body help me out. "I'am using div as parent and span as child on mouse over of child span i want to make parent div background color change"

Arnold
  • 23
  • 1
  • 8
  • 3
    That's not possible using CSS2 or CSS3: http://stackoverflow.com/questions/1014861/is-there-a-css-parent-selector – str Dec 06 '13 at 14:18
  • 1
    you need JavaScript to do that, because you can not select parent in CSS 2. – Mark Dec 06 '13 at 14:21

1 Answers1

1

well.... not really but you can make it look like. selectors always go the direction from parent to child. but you can try something using position: absolute of a background-simulating element inside the child element

http://jsfiddle.net/Kq4JJ/

edit note: this highly depends on the rest of your css! no element between the parent that should have the background and the hovering child (including itself) must have position, no matter if relative or absolute. otherwise the background will only cover that element.

Ria Weyprecht
  • 1,275
  • 9
  • 19