Centering div position - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

Centering div position

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">
.container {<!--  w w w.  j a v  a2  s. c om-->
   width:81%;
   height:401px;
   background-color:Chartreuse;
   margin-top:91px;
   position:relative;
}

.circle {
   width:61px;
   height:61px;
   position:relative;
   top:-16px;
   margin:0 auto;
   background-color:yellow;
   border-radius:51%;
}
</style> 
 </head> 
 <body> 
  <div class="container"> 
   <div class="circle"></div> 
  </div>  
 </body>
</html>

Related Tutorials