re: The 6 most common mistakes developers when writing HTML and CSS VIEW POST

re: Nice, some good points. This is really short-sighted though: "Using display: block and position: absolute (fixed) together". In all browsers? In on...

I have not thought about this before. So I checked it with a CodePen and found this sentence in the Specification:

An absolutely positioned box establishes a new containing block for normal flow children and absolutely (but not fixed) positioned descendants.

I assume that these words about "new containing block" force browser developers to display absolutely positioned pseudo-element as a block.


No they don't. display:inline-block, display:table-cell and display:list-item all establish containing blocks, so any of those would also be consistent with that sentence from the spec. What you are looking for is section 9.7 Relationships between 'display', 'position', and 'float', step 2

code of conduct - report abuse