html - Navigation Bar positioning Elements -
hello need build: mockup
i stuck @ navigation bar, here css:
/* css document */
body {background:#fff url(bg.jpg) repeat-x; margin:0; padding:0; height:1800px; font- family:arial, helvetica, sans-serif;} #wrapper {width: 1000px; margin: 0 auto;} #header {height: 400px; width: 1000px; display: block; position: relative; } #header .logo {position: absolute; width: 374px; height: 221px; display: block; float: left; cursor: pointer; background: url(logo.png) 0 0 no-repeat transparent; top: 55px; left: 10px;} #header .contact-info {position: absolute; width: 293px; height: 133px; display: block; float: left; cursor: pointer; background: url(contact-info.png) 0 0 no-repeat transparent; top: 100px; left: 700px;} ul.mn { position: absolute; float: left; top: 316px; width: 316px; margin: 0; padding: 0; list-style-type: none; } ul.mn li { float: left; } ul.mn li { display: block; float: left; height: 73px; margin-left: 6px; } ul.mn li a.mn1 { width: 104px; background-image: url('mn1.png'); background-position: 0 0; } ul.mn li a.mn2 { width: 212px; background-image: url('mn2.png'); } ul.mn li a.active, ul.mn li a:hover { background-position: 0 73px; } and html:
<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>rw-fliesen</title> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <div id="wrapper"> <div id="header_wrapper"> <div id="header"> <a href="index.html" class="logo" title="logo"></a> <div class="contact-info" title="contact-info"></div> <ul class="mn"> <li><a href=" " title="" class="mn1 "></a></li> <li><a href=" " title="" class="mn2 "></a></li> </ul> </div> </div> </div> </body> </html> when have 1 navigation element looks good: navi 1 element
but when add second navigation element, navi looks that: navi more 1 element
how can fix it?
i guess giving width each li tag.
ul.mn li a.mn1 { width: 104px; background-image: url('mn1.png'); background-position: 0 0; } in above code have given width of 104px image home 104px wide. guessing next menu item having greater width it's parent ul cant accommodate in 1 line. ul has width of 316px.
ul.mn { position: absolute; float: left; top: 316px; width: 316px; margin: 0; padding: 0; list-style-type: none; } you need increase width of ul make work.
Comments
Post a Comment