Are elements with
position: absolute;
able to have a height, width, padding, etc. without changing it to display: block;
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
.
Short answer: yes.
Long answer: see http://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo (or SLaks's answer).
Hovewer, this change refers only to the visual display model of the element. The CSS can't affect the content model of the HTML element since CSS is applied only after the document is parsed into DOM tree. So span
element can never have p
or div
children, no matter which styles are applied to it.