Align all divs to center in HTML5 - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Div Align

Description

Align all divs to center in HTML5

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">
.chartContainer {<!--from  ww w  .j av a  2s  .co m-->
   width:281px;
   height:241px;
   position:relative;
   margin:3.6px;
   background-color:Chartreuse;
   border-radius:6px;
   border:2.6px solid yellow;
   display:inline-block;
}
</style> 
 </head> 
 <body> 
  <div style="min-height: 1000px;text-align:center; position: relative;"> 
   <div style="position: relative; min-height: 1000px;"> 
    <div id="Steps" class="chartContainer"></div> 
    <div id="Distance" class="chartContainer"></div> 
    <div id="Floors" class="chartContainer"></div> 
    <div id="ActivityMinutes" class="chartContainer"></div> 
    <div id="Calories" class="chartContainer"></div> 
    <div id="Weights" class="chartContainer"></div> 
    <div id="BMI" class="chartContainer"></div> 
    <div id="Sleep" class="chartContainer"></div> 
    <div id="Food" class="chartContainer"></div> 
    <div id="Water" class="chartContainer"></div> 
    <div id="BloodPressure" class="chartContainer"></div> 
    <div id="Glucose" class="chartContainer"></div> 
    <div id="HeartRate" class="chartContainer"></div> 
    <div id="Devices" class="chartContainer"></div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials