Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change font size in html?

Tags:

html

fonts

size

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:

<html>
<head>
<style>
  p {
    color: red;
  }
</style>
</head>
<body>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
</body>
</html>
like image 344
Pancake_Senpai Avatar asked Aug 02 '13 01:08

Pancake_Senpai


People also ask

How do I change text font in HTML?

To change the text font in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <p> tag, with the CSS property font-family, font-size, font-style, etc. HTML5 do not support the <font> tag, so the CSS style is used to change font.

Which HTML tag is used to change the font size?

The <font> tag was used in HTML 4 to specify the font face, font size, and color of text.


2 Answers

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

like image 172
Thanos Avatar answered Oct 02 '22 20:10

Thanos


Or add styles inline:

<p style="font-size:18px">Paragraph 1</p>
<p style="font-size:16px">Paragraph 2</p>
like image 34
Roel Magdaleno Avatar answered Oct 02 '22 19:10

Roel Magdaleno