Skip to main content

2 docs tagged with "css"

View all tags

Box model — what "width" actually refers to

This chapter covers the CSS box model — the four regions of content, padding, border, and margin, and how box-sizing changes the interpretation of width. It walks through how far the background gets painted, when margin collapsing happens, and the idiom of applying border-box in a reset.

Selectors and cascade — combinators, pseudo-classes, and specificity

This chapter explains the kinds of CSS selectors, the difference between combinators, the distinction between pseudo-classes and pseudo-elements, and how to compute specificity. It covers the ordering between IDs and classes, the fact that the universal selector and combinators don't contribute to specificity, and what the cascade looks at beyond specificity.