Skip to content

How to change font style in HTML | HTML font style examples

How to change font style in HTML?

There are multiple ways to change font style in HTML, the Basic way is the inline CSS style attribute. Another way is Using a style tag in the head tag to the external CSS file.

<p style = "style_definitions">This is demo text</p>

Example of HTML font style (color, size, bold)

Example code of change the p tag font color , weight and size using inline style attribute in HMLT.

<!DOCTYPE html>
<html>
<body>
    <p style="color:green;font-size:46px;font-weight: bold;">
        I'm a big, bold blue, Text
  </p>
</body>
</html>

Output:

Example of HTML font style color size bold

Let’s see how to change the font in CSS?

Set font family of a text is set with the font-family property to change the font type in HTML.

<p style = "font-family:georgia" </p>

Complete example code

<!DOCTYPE html>
<html>
<body>
    <p style="font-family:georgia;font-size:46px;">
        NEW Font
    </p>
</body>
</html>

Output: With inspect elements

change the font in CSS

Do comment if you have any doubts and suggestions on this tutorial.

Note: The All HTML Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

1 thought on “How to change font style in HTML | HTML font style examples”

Leave a Reply

Your email address will not be published. Required fields are marked *