The image that i attached should show what i get as result. What i want is the nav div border to be on/just above the wrap div. And it all worked fine, untill i actulle added text to the layout. If i remove all the text from the content div it shows how i actulle want it. (It did before i started to try fix this out).
<!DOCTYPE html> <html> <head> <link type="text/css" rel="stylesheet" href="style.css" /> </head> <body> <div id="header"> <div id="nav"> <ul> <li class="active"><a href="#"><span>Hovedside</span></a></li> <li><a href="#"><span>Om oss</span></a></li> <li><a href="#"><span>Portofølje</span></a></li> <li><a href="#"><span>Gratis</span></a></li> <li><a href="#"><span>Tilbud</span></a></li> <li><a href="#"><span>Kontakt oss</span></a></li> <li><a href="#"><span>Panel</span></a></li> </ul> </div> </div> <div id="wrap"> <div id="wrapper"> <div id="content"> <p>Dette er tekst i p paranteser</p><p>Dette er tekst i p paranteser</p><p>Dette er tekst i p paranteser</p> </div> </div> </div> <div id="footer"> <div id ="footer-en"> en </div> <div id ="footer-to"> to </div> <div id ="footer-tre"> tre </div> <div id ="footer-fire"> </div> </div> </body> </html>
html, body { background: #514539; margin: 0 auto; height: 100%; color:#FFFFFF; font-family:Verdana, Geneva, sans-serif; font-size: 1em; } a{ color:#FFFFFF; background: #514539; } p{ padding: 5px; } #header{ width: 100%; height: 44px; border-bottom: 1px solid #645546; } #nav { margin: 0 auto; width:800px; } #nav ul { margin:0 2px; list-style:none; padding: 0; } #nav ul li { list-style:none; } #nav ul li a { float:left; margin:14px 1px; padding:5px 10px; background:#634f3d; text-decoration:none; color:#fff; border-top:1px solid #645546; border-left:1px solid #645546; border-right:1px solid #645546; font-size: 1em; } #nav ul li a:hover { background:#2d2620; color:#fff; } #nav ul li.active a, #nav ul li.active a:hover { background:#2d2620; color:#fff; font-weight:bold; height: 28px; margin-top: 6px; } #wrap{ background: #2d2620; width:100%; border-bottom: 1px solid #645546; padding-bottom: 50px; margin: 0 auto; position: relative; float: left; } #wrapper{ width: 800px; margin:0 auto; } #content{ min-height: 500px; } .content{ } #footer{ margin:0 auto; width: 800px; font-size: 0.8em; } #footer-en{ width:33%; display: inline-block; float: left; } #footer-to{ width:33%; display: inline-block; float: left; } #footer-tre{ width:33%; display: inline-block; float: left; } #footer-fire{ width:800px; }
Attachment | Size |
---|---|
Untitled-2.jpg | 289.15 KB |
Not tested
I suspect margin collapse is the culprit. See Uncollapsing margins.
N.B. The div #nav is redundant. Unless you are using the html5 <nav> element, there is no need for the extra div element.
cheers,
gary
hm im sure thats the problem,
hm im sure thats the problem, but i cant make it work. i even tried to make a "plain" layout, and i notice now that i get the same problem here.
Margins
See
#nav ul li a { background: none repeat scroll 0 0 #634F3D; border-left: 1px solid #645546; border-right: 1px solid #645546; border-top: 1px solid #645546; color: #FFFFFF; float: left; font-size: 1em;margin: 14px 1px;margin: 14px 1px 0; text-decoration: none; }
The bottom margin on <a> collapse through.
cheers,
gary
thank you very much! i will
thank you very much! i will look more into this. so the 3d margin value should be put in my cases. (x-px x-px 0 ) so that it marge bottom with 0. thanks again it solved this issue!