the img
is technically an inline element, so defaults to its own size rather than the size of its parent
should set either width
or height
on an image, if you set both it could get distorted
should apply this styling to all images:
img {
max-width: 100%;
display: block;
}
max-width
keeps them from becoming larger. the display: block
is for spacing issues that are caused by it being inline
max-width
(along with a width
percentage) to prevent your content from getting too wide on large screen sizespx
used to mean one point on the screen; but since screens began to have wildly varying resolutions, it was standardized to the reference pixel (1/196th of an inch)font-size
set (e.g. from the body
)
font-weight
1em
: match the font size of the parent
body
is 10px, its child has 1.5em, and its grandchild has 2em, then the grandchild font size becomes 30px)rem
= root em
html
element16px
em
unit is relative to different things depending on the property it's applied to:
font-size
: em
is relative to the font-size
of the parent (or closest ancestor that has font-size
set)width
, padding
): em
is relative to the font-size
of the current elementrem
for font sizes (to avoid cascading effects), and em
for other sizes (so that it can be anchored on the element's own font size).col
is for all columns, .col-bg
is for columns of a specific background, and .col-1
, .col-2
set the widths of the column.container
(a general container that applies padding and is centered using margin: 0 auto
) and .container-nav
(which is for the nav bar, might apply certain flex properties)