Search code examples
htmlfontssize

How to change font size in html?


I am trying to make a website and I want to know how to change the size of text in a paragraph. I want paragraph 1 to be bigger than paragraph 2. It doesn't matter how much bigger, as long as it's bigger. How do I do this?

My code is below:

p {
  color: red;
}
<p>Paragraph 1</p>
<p>Paragraph 2</p>


Solution

  • Give them a class and add your style to the class.

    <style>
      p {
        color: red;
      }
      .paragraph1 {
        font-size: 18px;
      }
      .paragraph2 {
        font-size: 13px;
      }
    </style>
    
    <p class="paragraph1">Paragraph 1</p>
    <p class="paragraph2">Paragraph 2</p>
    

    Check this EXAMPLE