Why CSS hover effect with class selector does not work with nested layout? -


simple code.jsfiddle

<!doctype html> <html>     <head>         <meta charset="utf-8" />         <title></title>         <link rel="stylesheet" type="text/css" href="css/normalize.css"/>         <link rel="stylesheet" type="text/css" href="css/style.css"/>     </head>     <body>          <div class="header">             <div class="nav">                 <div class="navtitle">1</div>                 <div class="subnav subnav1">test1</div>                 <div class="subnav subnav2">test2</div>                 <div class="subnav subnav3">test3</div>                 <div class="subnav subnav4">test4</div>             </div>          </div>          <div class="container">          </div>          <div class="left">             <div class="lefteles leftele1"></div>             <div class="lefteles leftele2"></div>             <div class="lefteles leftele3"></div>             <div class="lefteles leftele4"></div>             <div class="lefteles leftele5"></div>         </div>          <div class="footer">          </div>             <script src="js/jquery-2.1.1.min.js" type="text/javascript" charset="utf-8"></script>         <script src="js/script.js" type="text/javascript" charset="utf-8"></script>     </body> </html> 

and css.

body{     overflow: hidden;     font-size: 20px;     padding: 0;     margin: 0; }  .header{     width: 100%;     height: 50px;     background-color: #0092c7;     position: relative; }  .left{     position: absolute;     left: 0;     top: 50px;     width: 200px;     bottom: 0;     border-right: 1px solid #c0c0c0; }  .container{     position: absolute;     left: 200px;     top: 50px;     bottom: 0;     right: 0; }  .lefteles{     width: 100%;     height: 50px;     background-color: #f4f3de;     border-bottom: 1px solid #c0c0c0;     cursor: pointer; }  .lefteles:hover{     opacity: 0.7; }  .nav{     width: 200px;     height: 250px;     line-height: 50px;     float: right;     text-align: center; }  .navtitle{     border-left: 1px solid #c0c0c0; }  .subnav{     border-bottom: 1px solid #c0c0c0;     background-color: rgba(0,146,199,0.7);     cursor: pointer; }  .subnav:hover{     color: #ffffff; } 

i'm curious why hover , cursor effect on .subnav won't work!
simple , silly question. me, many thx!

your effect not working because of .container overlapping .header

use z-index css on .header:

z-index: 2; 

complete css of .header

.header{     width: 100%;     height: 50px;     z-index:2;     background-color: #0092c7;     position: relative; } 

updated demo


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -