CSS Styles are loaded from top to bottom. Newer styles overwrite old ones.
CSS Code Format
body { /* Selector. Select by tag */
color: red; /* Attribute: Value */
}
#idName { /* Select by ID */
}
.className { /* Select by class */
}
body .class h1 { /* Advanced selector: Search the body tag for a class, then search that class for h1 tags. All the h1 tags will be styled. */
}
![CSSContainers.jpg](<https://s3-us-west-2.amazonaws.com/secure.notion-static.com/f1920434-bf24-42e1-a735-d4ff68fa8d7a/CSSContainers.jpg>)
Width
/Height
of containerBorder
around containerPadding
:
Margin
:
Block
vs Inline
![CSSInlineBlock.jpg](<https://s3-us-west-2.amazonaws.com/secure.notion-static.com/ebb4fc90-264a-4e48-9140-9119a0f22da5/CSSInlineBlock.jpg>)
display
CSS property.Float
Float: left
positions the container to the left, and all nearby containers will wrap around it.Position
Relative
: reposition it relative to where it was before.Absolute
: reposition it by how far it is from the nearest element.EM
/REM
(scalable size)PX
/PT
(non-scaling size)%
: High-level webpage layout and container proportions.EM
/REM
: Anything you want to scale with the size of the screen. Font size, margin, padding, content inside containers, etc.
PX
/PT
: Anything you don’t want to scale. Mainly borders.
max-width
: For screens with width less than or equal to that amount.orientation: landscape
: For screens in landscape (horizontal) mode.<div>
around your image a flexbox.align-items
for vertical alignment and justify-content
for horizontal alignment.max-width
and height
. Find a max-width that works on your computer as you shrink your webpage.