html - CSS vertical alignment table method has no effect -
i need vertically align box css without using display: inline-block
. don't know height of elements used way here described (css table method).
<div style="background-color: black"> <div style="background-color: aqua; display: table; margin: auto;"> <div style="background-color: aliceblue; width: 200px; float: left; display: table-cell; vertical-align: middle;"> <p>a</p> <p>a</p> <p>a</p> </div> <div style="background-color: green; height: 20px; width: 100px; float: left; display: table-cell; vertical-align: middle;"></div> <div style="background-color: aliceblue; width: 250px; float: left; display: table-cell; vertical-align: middle;"> <p>b</p> <p>b</p> <p>b</p> <p>b</p> </div> </div> </div>
however, vertical alignment on test page has no effect @ all. according computed css of these divs display value set block! how can make these divs appear in middle?
erase float:left
divs - display:table-cell
, float:left
makes no sense
codepen: http://codepen.io/anon/pen/orrndw
addition after comment:
like this: codepen.io/anon/pen/nrxalo ? inserted /nested div in each table-cell contains smaller elements, , assigned background-color table element itself.
Comments
Post a Comment