Arnold
Arnold

Reputation: 23

Only using CSS2 i want to change background color of parent on mouse over of its child element

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"

Upvotes: 0

Views: 108

Answers (1)

Ria Weyprecht
Ria Weyprecht

Reputation: 1275

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.

Upvotes: 1

Related Questions