html - Styling issue (using floats) -
i wonder why paragraph tag content fill in between 2 floated divs? want paragraph tagged content underneath header. also, why don't line returns show in paragraph tag?
here's js fiddle: http://jsfiddle.net/yf3nyfk1/
html:
<body> <div id="header-container"> <div id="header-wrap"> <div class="left logo logoimg"> <img src="http://i.imgur.com/dtmbhkq.png"/> </div> <ul class="nav"> <li class="contact">contact</li> <li class="about">about</li> <li class="portfolio">portfolio</li> </ul> </div> </div> <div> <p> lorem ipsum... </p> </div> </body>
css:
body { background: #000000; margin: 0; font-family: helvetica, arial, sans-serif; font-size: 12px; color: #ffffff; text-align: center; } h1 { font-size: 24px; color: #ff9000; } img { max-width: 100%; } .left { float: left; } ul{ padding: 0px 0px 0px; } .right.nav { float: right; } /******************************************************************************/ /* menus */ /******************************************************************************/ #header-container{ margin: auto; padding: 80px 0px 0px; max-width: 1160px; width: 100%; } #header-wrap{ padding: 0px 40px 0px; } .logo{ max-width: 440px; width: 100%; } ul{ list-style-type:none; display: inline-block; } .nav{ float:right; list-style-type:none; overflow: hidden; } .nav li{ float:right; overflow: hidden; } .portfolio{ color: #00bff3; border: 1px solid #00bff3; padding: 8px 4px 8px; margin-left: 0px; width: 87px; text-align: center; } .about{ color: #00bff3; border: 1px solid #00bff3; padding: 8px 4px 8px; margin-left: 10px; width: 60px; text-align: center; } .contact{ color: #00bff3; border: 1px solid #00bff3; padding: 8px 4px 8px; margin-left: 10px; width: 76px; text-align: center; } .orangebutton{ color: #ff9000; border: 1px solid #ff9000; margin: 0px 5px 0px; } /******************************************************************************/ /* media queries */ /******************************************************************************/ @media screen , (max-width: 867px) { #header-wrap{ padding: 10px; } .right{ float: none; } .nav{ float: none; } .left { float: none; } .logo{ margin:auto; } }
you need clear floats:
p { clear:both; }
as second question, html ignores whitespace, including linefeeds , carriage returns, collapsing them single space. have newlines, either insert break elements <br>
or end paragraph elements </p>
.
alternatively modify handling of whitespace setting whitespace:pre
on p
elements in css, never want. close paragraphs actual paragraphs.
Comments
Post a Comment