Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • HTML Tutorial
  • HTML Exercises
  • HTML Tags
  • HTML Attributes
  • Global Attributes
  • Event Attributes
  • HTML Interview Questions
  • HTML DOM
  • DOM Audio/Video
  • HTML 5
  • HTML Examples
  • Color Picker
  • A to Z Guide
  • HTML Formatter
Open In App
Next Article:
HTML <font> size Attribute
Next article icon

HTML <font> size Attribute

Last Updated : 18 Jun, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

The HTML <font> size attribute adjusts text size within `<font>` elements, simplifying font size modification directly. Deprecated in HTML5, it ranged from 1 to 7, defaulting to 3. For modern practices, CSS is recommended for more flexible and maintainable text styling.

Note: The <font> size attribute is not supported by HTML5.

Syntax

<font size="number">

Attribute Values

It contains a single value number that specifies the size of the text. The font size lies between 1 to 7. The default value of font size is 3.

Example 1: This example illustrates the use of the font size property, whose value ranges from 1 to 7 in HTML.

index.html
<!DOCTYPE html> <html> <head>     <title>HTML font size Attribute</title> </head> <body>     <font size="1">GeeksforGeeks!</font><br />     <font size="2">GeeksforGeeks!</font><br />     <font size="3">GeeksforGeeks!</font><br />     <font size="4">GeeksforGeeks!</font><br />     <font size="5">GeeksforGeeks!</font><br />     <font size="6">GeeksforGeeks!</font><br />     <font size="7">GeeksforGeeks!</font> </body> </html> 

Output

output
size attribute


Note: If you do not specify a font size, the default size for normal text, like paragraphs, is 16px (16px=1em).

Example 2: This example illustrates the use of the size attribute inside the <font> tag in HTML.

index.html
<!DOCTYPE html> <html> <head>     <title>HTML font size Attribute</title> </head> <body>     <font size="7" face="verdana" color="green">         GeeksforGeeks!     </font>     <br>     <hr>     <font size="6" face="arial" color="#008000">         GeeksforGeeks!     </font>     <br>     <hr>     <font size="5" face="sans-serif" color="rgb(128, 128, 0)">         GeeksforGeeks!     </font>     <br>     <hr>     <font size="4" face="times new roman" color="#008000">         GeeksforGeeks!     </font> </body> </html> 

Output

output
tag with different color, type & size attribute

Example 3: In this example, we have used the font size attribute & set it to different values in order to display similar to the use of HTML heading & paragraph.

index.html
<!DOCTYPE html> <html> <body>     <font size="6" face="sans-serif" color="green">         GeeksforGeeks     </font>     <br>     <hr>     <font size="3" face="Comic sans MS">         Learn Data Structures Online At            Your Own Pace With The Best Of Faculty            In The Industry. The Best Data Structures            Course Available Online From         Skilled And Experienced Faculty.     </font> </body> </html> 

Output

output
tag with different face & size attribute

Browser Support

AttributeChromeEdgeFirefoxSafariOpera
<font> size ✓ ✓ ✓ ✓ ✓
Desktopv1v12v1v1v15
Mobilev18‐v4v1v14


Note: Modern web development favors CSS for styling, offering greater flexibility and compatibility across browsers. Developers should adopt CSS for text size adjustments and embrace current best practices for web design.


Next Article
HTML <font> size Attribute

J

jit_t
Improve
Article Tags :
  • Web Technologies
  • HTML
  • HTML-Attributes

Similar Reads

    HTML | <basefont> size Attribute
    The HTML <basefont> size Attribute is used to specify the default font-size of document. There are two more attributes for <basfront> tag face and color that specify the color of the text and font-family of the text. The <basfront> tag is not supported in HTML 5. Syntax: <basefo
    1 min read
    HTML <font> face Attribute
    The HTML <font> face Attribute is used to specify the font family of the text inside the <font> element. Using the <font> tag for styling is outdated. Modern web design recommends using CSS instead of<font> tag.Note: The <font> face attribute is not supported by HTML5.S
    1 min read
    HTML <input> size Attribute
    HTML <input> size Attribute specifies the visible width of an <input> element, typically for text input fields. It determines the width in terms of characters displayed, providing visual control over input size. Syntax:<input size="number"> Attribute values: It contains the numeric
    2 min read
    HTML | <link> sizes Attribute
    The HTML link sizes Attribute is used to specify the sizes of the icon for visual media and it only works when rel=”icon”. It is a read-only Property. Syntax: <link sizes="HeightxWidth | any"> Attribute Values HeightxWidth It is used to specify the one or more sizes of a linked icon. The value
    1 min read
    HTML | <select> size Attribute
    The HTML size Attribute is used to specifies the number of visible options in a drop-down list. Note: If the value of the size attribute is greater than 1 but lower that the number of options in a DropDown List. so the Browser will automatically add the scrollbar for specifying that there are more o
    1 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences