php - Can :hover apply to generic element tags specific to a parent div? -
i using bunch of divs (created php) generate block of clickable elements. need apply styles these generic elements, rather specific ones, yet using code below seems invalid.
#container { height: 80%; width: 60%; background-color: green; } #container div:hover { background-color: blue; } <div id="container"> <div style="background-color: red; width: 100px; height: 100px;"> </div>
so not sure if issue generic div element cannot styled sub-element , have :hover attribute operates properly. know classes or id's can specified handle this, have thousands of unique divs. cannot use
#container:hover div{ background-color: blue;}
as seems invalid, need select 1 element block, , not @ once.
any ideas here? in advance.
this work if remove background color html, , apply using css:
#container { height: 80%; width: 60%; background-color: green; } #container div {background-color: red;} #container div:hover { background-color: blue; }
example: http://jsfiddle.net/xd2ez/1/
the reasone css specificity - style
attribute rule more specific (stronger) id + element rule.
Comments
Post a Comment