css - Align all divs to center in HTML5 -
i have dashboard has many div's.
i need position divs center when user re sizes page below:
the html divs below:
<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> .chartcontainer { width: 280px; height: 240px; float: left; position: relative; margin: 2.5px; background-color: #f5f5f5 !important; border-radius: 5px; border: 1.5px solid #e3e3e3; }
remove float:left
, add display:inline-block
if you're using media-queries, can set float
none
@ smaller screen size.
Comments
Post a Comment