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
to start fromDisplay: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 boxdisplay
property
Box Generation Values
display
propertydisplay: none
Removes Box Tree
display: contents
Removes Box
div
s when doing layoutdisplay: list-item
Adds Marker Box
list-item
keyword::marker
boxinline
or block
display
propInline
or block
flow
layoutline-height
(initial normal
from font metrics)writing mode
[demo link]inline
axis is not always the width
direction
[demo link]inline-size
from Context
look up to parents…
block-size
from Content
look down to children…
display
…
None or Contents
display
…
List-Item
display
…
Inline or Block
display
…
Flex, Grid, Table-*…
display
…
Flow or Flow-Root
flow
or flow-root
Flow
is our default inner display valuedisplay: block
display: block
flow
;
inline
» inline
flow
overflow: hidden;
“A mini layout in your layout”…
overflow:hidden
inline-block
block
display: flex
display:
block
flex;
grid
» block
grid
inline-flex
, inline-grid
, inline-block
block
» block flow
flow-root
» block flow-root
inline
» inline flow
flex
» block flex
grid
» block grid
list-item
» block flow list-item
inline-block
» inline flow-root
inline-flex
» inline flex
inline-grid
» inline grid
display: list-item
display:
block flow
list-item;
list-item
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-box
box-sizing: border-box
on all elementswidth
-> inline-size
height
-> block-size
top
-> block-start
bottom
-> block-end
left
-> inline-start
right
-> inline-end
margin-right
-> margin-inline-end
margin-block
, padding-inline
, border-block
input {
margin-inline-end: 1em;
margin-left: 0;
}
block flex
or inline flex
.default-values {
flex-direction: row; /* column[-reverse] */
flex-wrap: nowrap; /* wrap | wrap-reverse */
}
<number>
Distribution of Available Space
<number>
Distribution of Unavailable Space
The ideal starting width, before flexing
initial
| 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
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