css3 - How to make entire div change color on hover using css? -


i have following:

    <div id="side-menu" class="sidebar-nav span2">         <div class="sidebar-link"><span>link 1</span></div>         <div class="sidebar-link"><span>link 2</span></div>     </div> 

i'm trying make each of 2 divs change color when hover on them - whether hover on text of off right or left of text. color changes if hover on text. idea how can done? here's fiddle css:

http://jsfiddle.net/ptskr/56/

you have space in hover selector. matters because space descendant selector in css

div.sidebar-link :hover{     background-color: #e3e3e3; } 

this means hovered descendants of .sidebar-link affected rules. remove space.

http://jsfiddle.net/explosionpills/ptskr/57/


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -