From the course: CSS Fundamentals: Unlock the Power of Web Styling

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Understanding the units of measurement

Understanding the units of measurement - CSS Tutorial

From the course: CSS Fundamentals: Unlock the Power of Web Styling

Understanding the units of measurement

- [Instructor] There are times when you need to set a link for a CSS element. CSS offers support for many units of measurement, including those for both onscreen and print. Some of these units are absolute or fixed length while others are relative. I'm going to limit our discussion here to the foremost common types that you'll run across as you're learning CSS. First, we have pixels. Then we have ems, rems, and finally, percentages. So pixels are referred to as an absolute value and just like an inch takes up a physical amount of space, so does a pixel. With CSS, we can use pixels to define heights and widths for things like block-level elements, padding, margin, font sizes, and here's a couple of examples of those things in action. Next we have ems, and unlike pixels, these are considered relative values. They're relative to the font size of a parent element. So the name actually comes from print topography and it…

Contents