Center div inside parent div - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Div

Description

Center div inside parent 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">
#number-one {<!--  w w w. ja v  a2 s  .  c o m-->
   border:2px solid;
   display:block;
   height:301px;
   vertical-align:middle;
   width:301px;
}

#number-two {
   background-color:Chartreuse;
   height:100px;
   margin:100px;
   width:100px;
}
</style> 
  <script type="text/javascript">

      </script> 
 </head> 
 <body> 
  <div id="number-one"> 
   <div id="number-two"></div> 
  </div>  
 </body>
</html>

Related Tutorials