How to Change Font Size in HTML ? Last Updated : 26 Mar, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report To change the font size of any text we can use the CSS font-size Property, or some HTML keywords have some fixed font size but we change them by using this CSS property. We can use style attributes in the HTML. As we know, HTML has no <font> tag, so we are using CSS style to add font size. The CSS font-size property enables specifying the size of text within HTML elements. It accepts various units such as pixels, ems, or percentages to determine the font size, allowing precise control over text appearance and readability. Syntax: font-size: medium|xx-small|x-small|small|large|x-large|xx-large|smaller|larger|length|initial|inherit;Example: In this example, we defined the class in HTML and then applied the property in CSS. HTML <!DOCTYPE html> <html> <head> <title>CSS font-size property</title> <!-- CSS style to set font-size property --> <style> .xxsmall { font-size: xx-small; } .xsmall { font-size: x-small; } .small { font-size: small; } .medium { font-size: medium; } .large { font-size: large; } .xlarge { font-size: x-large; } .xxlarge { font-size: xx-large; } </style> </head> <body> <h1>Changing the Font Size</h1> <div class="xxsmall"> font-size: xx-small; </div> <div class="xsmall"> font-size: x-small; </div> <div class="small">font-size: small;</div> <div class="medium"> font-size: medium; </div> <div class="large">font-size: large;</div> <div class="xlarge"> font-size: x-large; </div> <div class="xxlarge"> font-size: xx-large; </div> </body> </html> Output: font sizeExample 2 : In this example,we are inline styling Sets heading color to green and font size to 40px. Sets paragraph color to blue and font size to 18px for GeeksforGeeks welcome message. HTML <!DOCTYPE html> <html> <head> <title>HTMLFont size</title> </head> <body> <h1 style="color: green; font-size: 40px"> Welcome to GeeksforGeeks </h1> <p style="color: blue; font-size: 18px"> Inline styling </p> </body> </html> Output: Comment More infoAdvertise with us Next Article How to Change Font Size in HTML ? S skyridetim Follow Improve Article Tags : Web Technologies HTML HTML-Questions Similar Reads How to Change the Font Size in HTML? Changing the font size in HTML helps control the readability and visual hierarchy of your content. Earlier, the <font> tag with the size attribute was commonly used for this purpose. However, with the introduction of HTML5, the <font> tag has been deprecated and is no longer recommended. 2 min read How To Change Font in HTML? Changing fonts in HTML can enhance the visual appeal and readability of your website by up to 80%, according to design studies. Well-chosen fonts help set the tone of your content and improve user engagement. In this article, weâll explore different methods to adjust font style, size, and type using 5 min read How to Change Font-size and Color in HTML? To change the font-size and color in HTML, a style tag with color and font properties is used.1. Using Inline Style AttributeIn this approach, a style attribute is used in the tag for which we want to change the font size and color. Below are the properties that we will use inside the style attribut 2 min read How to Change Font Color in HTML? We can use <font> tag to change the text color in HTML. This tag was used in older versions of HTML but is deprecated in HTML5. So we can use inline CSS as the best and quickest way to change the font color. 1. Change Font Color using <Font> tagThe <font> tag was used to change tex 2 min read How To Change Image Size In HTML? To change the size of an image in HTML, you can use width and height attribute within <img> tag. Alternatively, we can use CSS properties to set or change the image size. Change image size feature is useful while developing a responsive web page.Table of ContentUsing HTML width and height Attr 3 min read Like