From the course: CSS Essential Training

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

The font-size property

The font-size property - CSS Tutorial

From the course: CSS Essential Training

Start my 1-month free trial

The font-size property

- [Instructor] The font-size property defines the size of HTML texts and can be used with a variety of value types. In this lesson, we'll focus on three commonly used types, pixel, em and rem. Using pixels for sizing is an ideal unit for accuracy since pixels are an absolute value, meaning they're fixed and not affected by font sizing styles in ancestor elements. Also, stick to using whole number values since different browsers interpret decimal values inconsistently with some rounding up and others rounding down. The default size of the base text in an HTML document is equivalent to 16 pixels with the exception of headings. Headings are bigger or smaller depending on the heading level. The em unit is named after the letter M, which was historically used in typography to measure widths. In CSS, em is a relative unit, sized in relation to its closest ancestor element, font-size. 1em is equal to its inherited font size.…

Contents