Space between html5 elements -
okay i'm trying start scratch building html5 site css, i've tried hard eliminate spaces between elements: header, nav, article, , footer
they stay there. know it's basic question i've spend time on , still can't figure what's going on.
any ideas how remove it?
(if copy , save these files you'll see space)
thank you
code:
<html> <head> <meta charset="utf-8" /> <title>my first website</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="wraper"> <header> <h1>header</h1> </header> <nav> <ul> <li> inicio </li> <li> conceito </li> <li> fotos </li> <li> informações </li> <li> contato </li> </ul> </nav> <article> <p> lore ipsum lore ipsum lore ipsum lore ipsum abc lore ipsum bdede lore ipsum lore ipsum lore ipsum lore ipsum lore ipsum lore ipsum lore ipsum abc lore ipsum bdede lore ipsum lore ipsum lore ipsum lore ipsum lore ipsum lore ipsum lore ipsum abc lore ipsum bdede lore ipsum lore ipsum lore ipsum. </p> </article> <footer> <p>rua b, lote 16, vila dom pedro i, paraty</p> </footer> </div> </body> </html>
css code:
body { margin: 0; height: 100%; font-family: sans-serif; background-color: #f2e8bd; } .wraper { width: 960px; background-color: #ccc49f; margin-left: auto; margin-right: auto; } nav, header, footer { margin-top: 0; padding: 0; margin: 0; } nav ul{ margin: 0; } header{ background-color: #f0f; } nav{ background-color: #08a; } nav li{ display: inline; } article { background-color: yellow; } footer { margin: 0; background-color: red; }
you eliminated margins on wrapper containers, not on respective content <p>
, <h1>
.
to remove spaces, add (or similar) css:
h1 { margin: 0 } p { margin: 0 }
Comments
Post a Comment