/* a 'declaration' */
width: 500px;
width: 500px;
text-wrap: pretty;
width: 500px;

content-box model
border-box modelinline-size: 500px;
width we care about exactly,inline-size: 45em;
width: min-content; width: max-content;
width: 100%; width: 90vw; width: 80cqi;
width: min(45em, 100%);

Graphic design of unknown content with unknown collaborators, on an infinite and unknowable canvas, across operating systems, interfaces, languages, and writing modes…

There are too many variables to consider. The point of CSS is to make it so you don’t have to worry about them all.
width: auto;
The fact we can control a paper page is really a limitation of that medium.
It takes craft to set up the circumstances that are simple and yet contain the ambiguities and the incongruity of human experience.
500px wide)16px != 1em
1em sometimes gives the same result as 16pxflex != grid
Mostly based on formatting contexts
display properties…demo:
span with text & outlinewidthheightdisplay: blockdisplay of the element…body { display: flex; }display: blockwidth to be largefloatbody display valueposition: fixed | absolute)

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

Including % and other ‘relative’ units
min-content |max-content | fit-content
box-sizing property…
Selects Box Edge for Sizing
* { box-sizing: border-box; }
/* ::before, ::after {
box-sizing: border-box;
} */
content-boxbox-sizing: border-box on all elementsDisplay: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 property
Box Generation Values
display propertydisplay: none
Removes Box Tree
display: contents
Removes Box
divs when doing layoutdisplay: list-item
Adds Marker Box
list-item keyword::marker boxinline or block
display propInline or blockflow layoutwriting mode
[flow-inline-vert: flow-inline-vert]inline axis is not always the widthdirection
[flow-inline-rtl: flow-inline-rtl]line-height (initial normal from font metrics)inline layoutblock-size look down to children…
inline-size look up to parents…
width -> inline-sizeheight -> block-sizetop -> block-startbottom -> block-endleft -> inline-startright -> inline-endmargin-right -> margin-inline-endmargin-block, padding-inline, border-blockinput {
margin-inline-end: 1em;
margin-left: 0;
}
display (inline or block)…
Often Ignored
(especially display: inline)
grid flowinline or block are ignoreddisplay…
Flex, Grid, Table-*, Flow
blockdisplay: flex
display: block flex;
grid » block gridinitial | auto | none | <grow>
Initial
Shrink, If Necessary
Same as 0 1 auto
Auto
Shrink or Grow
Same as 1 1 auto
None
Don’t Flex
Same as 0 0 auto
<grow>
Share Space Equally
Same as <grow> 1 0

display…
Flex, Grid, Table-*, Flow
Flow is our default inner display valuedisplay: block
display: block flow;
inline » inline flowoverflow: hidden;display…
Flow & Flow-Root
flow or flow-root“A mini layout in your layout”…

overflow: hiddeninline-block
inline-flex, inline-grid, inline-block
block » 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 griddisplay: list-item
display: block flow list-item;
list-itemdisplay…
List-Item
::marker to style markerslist-style-position to move marker boxMulti-Value Display
overflow-x/-y | overflow-inline/-block
Acts like auto when single-axis
padding-box edgepadding-box + overflow-clip-margin edge
Overflow Clip
(usually auto…)
clip | ellipsis
break-word | anywhere
distributing extra space
start | center | end
stretch | space-between | space-around | space-evenly
What boxes are we positioning?
Which axis are we manipulating?
justify-* props apply to the ‘main’ axisalign-* props apply to the ‘cross’ axisContent, items, & self – on either axis
align-content onlyjustify an individual item,safe | unsafe
baseline | first baseline | last baseline
[demo] change to use intrinsic sizes