Font size in CSS
Let's learn how to change the font size. The font-size property is intended for this, taking a value in pixels.
Let's give the paragraph text a font size of 30 pixels:
<p>
This is a paragraph with text.
</p>
p {
font-size: 30px;
}
:
Copy the following HTML code to your page:
<h1>Main page title</h1>
<p>
This is a paragraph with text.
</p>
<h2>Secondary heading 1</h2>
<p>
This is a paragraph with text.
</p>
<p>
This is a paragraph with text.
</p>
<h2>Secondary heading 2</h2>
<p>
This is a paragraph with text.
</p>
<p>
This is a paragraph with text.
</p>
Set the heading h1 font size to 50px and center alignment, the headings h2 font size to 40px and no bold, and the paragraphs font size to 30px.