Add top margin to a div - HTML CSS CSS Property

HTML CSS examples for CSS Property:margin-top

Description

Add top margin to a div

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">
html {<!--from   ww  w .  j a v  a 2s .  c  o m-->
   font-size:17px;
}

body {
   background:Chartreuse;
   font-family:"Open Sans", sans-serif;
}

nav {
   position:absolute;
   width:100%;
   left:0;
   top:0;
   text-align:center;
   font-weight:401;
}

nav .menu {
   list-style-type:none;
   padding:0;
   margin:0;
}

nav .menu li {
   padding:4px 0 4px 0;
   display:none;
}

nav .menu li a {
   text-decoration:none;
   color:yellow;
   font-size:3.2em;
}

nav .menu .blog {
   background:blue;
}

nav .menu .contact {
   background:pink;
}

nav #touchNav {
   background:OrangeRed;
   width:100%;
   display:block;
   color:grey;
   font-size:3.2em;
   padding:4px 0 4px 0;
   text-decoration:none;
}

header {
   margin:51px 0 0 0;
   margin-top:51px;
   text-align:center;
   width:100%;
}

header h1 {
   margin:0 auto;
   width:100%;
}

header h1 .tech {
   color:BlueViolet;
   font-weight:501;
   margin-right:4.6px;
   font-size:2.2em;
}

header h1 .basics {
   color:Chartreuse;
   margin-left:4.6px;
   font-size:2.4em;
}

header h2 {
   font-size:3.2em;
   font-weight:100;
   width:100%;
   margin:0 auto;
   color:yellow;
   line-height:2.3em;
}

.circle {
   margin-top:100px;
   clear:both;
   width:21px;
   height:21px;
   background:blue;
   -moz-border-radius:11px;
   -webkit-border-radius:11px;
   border-radius:11px;
   margin-left:auto;
   margin-right:auto;
}
</style> 
 </head> 
 <body> 
  <div id="content"> 
   <header> 
    <h1> <span class="tech">Lore</span> <span class="basics">Lorem </span> </h1> 
    <h2>Lorem ipsum dolor sit ame</h2> 
   </header> 
   <div class="circle"></div> 
  </div>  
 </body>
</html>

Related Tutorials