html - CSS3 navigation bar top menu -
i want create navigation menu http://oi61.tinypic.com/345g7wz.jpg
but found problems. li background-color doesn't connected , display differently in ie
this code http://codepen.io/anon/pen/hdzif
html:
<body> <header> <div class="logo"></div> <nav> <ul> <li><a href="index.html" class="active">home</a></li> <li><a href="about-us.html">about us</a></li> <li><a href="cupcakes.html">cupcakes</a></li> <li class="empty"></li> <li><a href="how-to-order.html">how order</a></li> <li><a href="contact-us.html">contact us</a></li> <li><a href="faq.html">faq</a></li> </ul> </nav> <div class="line"></div> </header> </body>
css:
body { width: 960px; margin: 0 auto; } header { margin: 60px 0 40px; } .logo { height: 162px; width: 162px; background-color: #9bd1af; position: absolute; top: 5px; left: 50%; margin-left: -81px; z-index: 1; -webkit-border-radius: 80px; -moz-border-radius: 80px; border-radius: 80px; } .line { width: 100%; height: 10px; top: 6px; position: relative; background-color: #7e5a3a; } nav { width: 100%; text-transform: uppercase; } nav ul { margin: 0; padding: 0; list-style-type: none; text-align: center; } nav ul li { display: inline; background: #2d4c4e; padding: 10px 20px; } nav ul li.empty { padding: 10px 59px; } nav ul li { padding: 3px 10px; color: #f9eec6; background: #2d4c4e; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; text-decoration: none; } nav ul li a:hover { background-color: #7e5a3a; color: #fff; }
i found new problem again when post code @ http://jsfiddle.net/g8ssp/ logo not in place want when size of browser narrowed
.logo { height: 162px; width: 162px; background-color: #9bd1af; position: absolute; top: 5px; left: 50%; margin-left: -81px; z-index: 1; -webkit-border-radius: 80px; -moz-border-radius: 80px; border-radius: 80px; }
change this:
.logo { height: 162px; width: 162px; background-color: #9bd1af; position: relative; top:68px; left: 48%; margin-left: -81px; z-index: 1; -webkit-border-radius: 80px; -moz-border-radius: 80px; border-radius: 80px; }
the above logo being in place time! , space between list items disappear:
nav ul li { display: inline; background: #2d4c4e; padding: 10px 20px; margin-right:-7px; }
putting negative margin-right soves problem.
Comments
Post a Comment