How to change font style in HTML?
There are multiple ways to change font style in HTML, the Basic way is inline CSS style attribute. Another way is Using a style tag in the head tag to the external CSS file.
1 |
<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.
1 2 3 4 5 6 7 8 |
<!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:

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.
1 |
<p style = "font-family:georgia" </p> |
Complete example code
1 2 3 4 5 6 7 8 |
<!DOCTYPE html> <html> <body> <p style="font-family:georgia;font-size:46px;"> NEW Font </p> </body> </html> |
Output: With inspect elements

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