2 way to change your text font-size in HTML

To change the font-size of text in HTML, you can use the style attribute. the style attribute specifies an inline element of style. The attribute is used with the HTML <h1> tag, with the CSS property  font-size, font-style element , etc.

HTML5 do not support the <font> tag, so the CSS style can be used to change font-size. The <font> tag deprecated in HTML5.

How to change the font-size of text in HTML?

Just keep in mind, the usage of style attribute override any style set globally. It will override any style sheet set in the HTML <style> tag or style sheet.

<!DOCTYPE html> 
<html> 
<head> 
<title>thewholeblog.com</title> 
</head> 
<style type="text/css"> p{ font-size: 20px; } </style> 
<body> 
<p>wholeblog.com></p> 
</body> 
</html>


Centering a few blocks of text

If you have many blocks of text to change font-size use CSS inside tags in the head section or in an external style sheet. See the example code below for how to set all font-size of text inside the tags to be centered.


<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p style="font-size: 20px;">About Whole Blogs</p>
<p style="font-size: 12px">the whole blogs are for teaching and guiding people for any of the topics like 
Travelling, Technology, Health, Fashion, Beauty, Sports, etc to grow their knowledge about what the world 
had introduced and what we should learn first from <a href="https://wholeblogs.com/"><b>wholeblogs</b></a>. Whole blogs provide all blogs of technology, 
the latest trends of fashion, and all other topics on which peoples are interested.</p>
</body>
</html>

 

Leave a Comment