CSS takes a source document organized as a tree of elements… and text nodes… and renders it onto a canvas such as your screen.
The document canvas is the infinite surface over which the document is rendered.


width/height


direction
[demo link]writing mode
[demo link]width -> inline-sizeheight -> block-sizetop -> block-startbottom -> block-endleft -> inline-startright -> inline-endmargin-right with margin-inline-endmargin-block, padding-inline, border-blockinput {
  margin-inline-end: 1em;
  margin-left: 0;
}
…A tree of elements… and text nodes…
display property
Box Generation Values
  display propertyDisplay:none; (head/style) removes box & subtreeDisplay:contents; (figure?) removes boxDisplay:list-item; (li) generates a second ::marker boxList-style-position moves ::marker in or out of primary box

display: list-item
Adds Marker Box
  list-item display::marker boxdisplay: none
Removes Box Tree
  display: contents
Removes Box
  divs when doing layoutMostly based on formatting contexts
display)display
  primarily inside and outside modes
display creates
Inner Formatting Context
  display sets
Outer Flow Behavior
  display:
flow | flow-root
  block ➡️ block flow inline ➡️ inline flow
  displaydisplay property
Outer Display Values
  inline or block


display: inline-block,line-height propertyinline-size block-size line-heightblock-size Including % and other ‘relative’ units
min-content | max-content | fit-content
inline/block…
Often Ignored
  Only used in normal flow!
gridinline or block, just a ‘grid item’float or absolute position overrides inline/blockinline element is ‘blockified’display, position, and floatParent context can override
inline & inline-* ➡️ block & *
display…
Flex, Grid, Table-*, Flow
  block ➡️ block flow inline ➡️ inline flow
  grid ➡️ block grid flex ➡️ block flex table ➡️ block table
  block outer valueinline-grid ➡️ inline grid inline-flex ➡️ inline flex inline-block ➡️ inline flow-root
  inline-block is the most common option,overflow: hidden;“A mini layout in your layout”…
overflow: hiddenblock » block flowflow-root » block flow-rootinline » inline flowflex » block flexgrid » block gridlist-item » block flow list-iteminline-block » inline flow-rootinline-flex » inline flexinline-grid » inline gridbox-sizing property…
Selects Box Edge for Sizing
  

content-box model
border-box model/* initial value: content-box */
* { box-sizing: border-box; }
/* optional… */
/* ::before, ::after {
  box-sizing: border-box;
} */
content-box
Is Still Useful
  .container {
  inline-size: calc(34em + (var(--padding) * 2));
}
content-box sizing instead…