Loading…
A short voice session: one question, one follow-up, then instant feedback — up to 5 minutes.
px uses CSS pixels, rem uses the root font size, and em depends on the relevant font size. Media queries conditionally apply styles.
For font-size, em is relative to the inherited font size; for many other lengths such as padding, it is relative to the element's own font size. rem is relative to the root font size. A CSS pixel is not necessarily one physical screen pixel. A rule such as @media (max-width: 600px) { .cards { grid-template-columns: 1fr; } } changes the layout at a viewport-width condition, but a responsive layout also needs flexible sizing and content that can fit.