Logo
/
Frontend
/
CSS Course
/

Font size

CSS: Font size

Another way to separate sections of text is to use different font sizes. We've already seen that browsers style headings differently. It's the size of the text that separates the <h1> header from the <h2> header and so on.

You can control the size of the text in CSS by using the font-size property, which takes a numeric value and a unit of measure. For now, we'll use pixels as the unit of measurement, although there are a few other important units you'll have learned by the end of this course.

<p>Warning, this paragraph has the standard font size</p>
<p class="warning">This paragraph has a font size of 24 pixels</p>
.warning {
  font-size: 24px;
}

Paragraph with larger font size

Instructions

Add a paragraph to the editor with the class set to big and set the font size to 60 pixels. Add styles to the <style> tag

If you've reached a deadlock it's time to ask your question in the «Discussions». How ask a question correctly:

  • Be sure to attach the test output, without it it's almost impossible to figure out what went wrong, even if you show your code. It's complicated for developers to execute code in their heads, but having a mistake before their eyes most probably will be helpful.
Found a bug? Have something to add? Pull requests are welcome!