Apply margin-top and padding-top - HTML CSS CSS Property

HTML CSS examples for CSS Property:padding

Description

Apply margin-top and padding-top

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
* {<!-- www.  j a  va  2 s  .  c  om-->
   margin:0;
   padding:0;
}

html, body {
   width:100%;
   background:lightgray;
}

#container {
   width:100%;
}

#main-header {
   display:block;
}

#logo {
   position:absolute;
   top:0;
   left:0;
}

#main-nav {
   display:block;
   background:gray;
   margin:6em 7em;
}

#main-nav ul {
   list-style:none;
}

#main-nav .main-nav-link {
   display:inline-block;
}

#main-nav .main-nav-link a {
   display:inline-block;
   padding:0.9em 2em;
   text-decoration:none;
   color:Chartreuse;
   font:bold 2em arial;
}
</style> 
 </head> 
 <body> 
  <div id="container"> 
   <header id="main-header"> 
    <h3 id="logo">Lorem ips</h3> 
    <nav id="main-nav"> 
     <ul> 
      <li class="main-nav-link"> <a href="#">Lore</a> </li> 
      <li class="main-nav-link"> <a href="#">Lore</a> </li> 
      <li class="main-nav-link"> <a href="#">Lore</a> </li> 
     </ul> 
    </nav> 
   </header> 
  </div>  
 </body>
</html>

Related Tutorials