Are <span> elements with position: absolute; able to have a height, width, padding, etc. without changing it to display: block; or inline-block;?
It seems to work, but is it ok with all browsers to omit display: block/inline-block for a <span> element with position: absolute;?
The spec says yes:
Otherwise, if 'position' has the value 'absolute' or 'fixed', the box is absolutely positioned, the computed value of 'float' is 'none', and display is set according to the table below. The position of the box will be determined by the 'top', 'right', 'bottom' and 'left' properties and the box's containing block.
The table says that any inline display values (inline, table-row-group, table-column, table-column-group, table-header-group, table-footer-group, table-row, table-cell, table-caption, inline-block) become block.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With