html - Box model within table-cell display type -
this problem behaviour of box model within table-cell display type, particularly in google chrome. i've experimented while, still don't understand what's happening. here minimal working example of problem:
html:
<div class="table"> <div class="row"> <div class="cell"> <div class="container"> <div class="content"></div> </div> </div> </div> </div>
css:
* { box-sizing: border-box; } body { position: absolute; height: 100%; width: 100%; margin: 0; } .table { display: table; height: 100%; width: 100%; } .row { display: table-row; height: 100%; } .cell { display: table-cell; height: 100%; background-color: red; } .container { height: 100%; padding: 50px; background-color: lightgrey; } .content { height: 100%; background-color: grey; }
(you can use this fiddle.)
in firefox , internet explorer, cell fills whole page, containers border equals page boundaries, , content positioned symmetrically within. in chrome cell still fills whole page, , content still positioned symmetrically within container. however, containers bottom border positioned above page bottom (by twice padding).
for me looks if chrome applies vertical padding twice, second time @ bottom. happens border-box box-sizing.
question: can explain behaviour , difference between ff/ie , chrome?
Comments
Post a Comment