* { -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; margin:0; padding:0; } ul { list-style:none; } a { text-decoration:none; } .nav { width:1200px; margin:0 auto; height:50px; } .menu { height:50px; } .menu>li { float:left; position:relative; } .menu>li a { display:inline-block; height:50px; width:240px; line-height:50px; text-align:center; color:#fff; background:#0977bc; } .menu>li a:hover { background:#25aae1; } .menu>li a.active { background:#25aae1; } .menu-a { display:none; position:absolute; top:50px; left:0; z-index:999; }
该demo只适合初学者学习用,谢谢!