css - Why does the button element allow vertical-align: middle? -
as far i've been able read, vertical-align: middle;
css attribute works on elements display
option set table-cell
.
so why vertical-align
accepted on button
element? have missed something?
the reason question of cause want mimic button
behaviour, avoid using structure:
<div style="display: table"> <div style="display: table-cell; vertical-align: middle;">vertically aligned</div> </div>
according css 2.1 specification, vertical-align
property applies “ inline-level , 'table-cell' elements”, , inline-level elements “ inline-level elements elements of source document not form new blocks of content; content distributed in lines (e.g., emphasized pieces of text within paragraph, inline images, etc.). following values of 'display' property make element inline-level: 'inline', 'inline-table', , 'inline-block'.”
the button
element has display: inline-block
in default style sheet html 4, , corresponds browser practice.
thus, vertical-align
applies button
elements.
Comments
Post a Comment