HTML CSS examples for CSS Widget:Hover to change Color
Hover background for topmost div
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> body {<!--from w ww .j av a2s. c o m--> padding:26px; } .a { width:401px; height:351px; z-index:51; position:absolute; } .b { width:301px; height:251px; z-index:61; } .c { width:201px; height:151px; z-index:71; } .d { width:100px; height:51px; z-index:81; } div { padding-top:51px; margin:auto; border:2px solid Chartreuse; background:gray; position:absolute; } div:hover { background:lightGray; } </style> </head> <body> <div class="a"></div> <div class="b"></div> <div class="c"></div> <div class="d"></div> </body> </html>