Font Tag in HTML is one of the most important attributes used to make webpage or HTML documents more attractive. It has the properties to change the size, color, and style of included text. With the help of a font tag, one can make a web page’s size, color, and face in the same text format. This tag mainly works on three major attributes like size, Face or Type and color. Font tag works as an inline element in HTML to change some features of block text in HTML documents. The text enclosed within tag is used to define style to the text included in it.
Syntax:
<font size=" " face=" " color=" "></font>
- Above syntax status that font size is the attribute into the syntax is used to set the specific size to the text. This size can be defined in number from 1 to 7, where 1 is for the smallest text and 7 for the largest text size. The face attributes in the font tag used to define the type of font type in our HTML document, whereas the color attribute is used to define the specific color to the enclosed text.
- HTML tag used within the tag. It’s define using .. tag in HTML.
<p> <font size="2" color="blue" face="Calibri"> </font> </p>
This tag supports Global as well as Event attributes too. Also, it supports some other attributes which areas listed below:
|
Detail Description | ||||||||||
Size | This attribute is used to define a specific size for text in between 1 to 7. | ||||||||||
Face or type | This attribute is used to define the font type for the included text. | ||||||||||
Color | This attribute is used to show enclosed text in a different color. | ||||||||||
Weight | This attribute defines the boldness of the text of the font tag. |
Font tag can be used in two ways in HTML code, first as include font tag and its attribute value through HTML and second is by using define attribute value as CSS code. Both will generate the same output. The only difference in defining attributes value.
Example #1
Defining font tag with its attribute value:
html> <title>Font Tag in HTML</title> <h2 id="Example-of-Font-Tag-in-HTML">Example of Font Tag in HTML </h2> <p>General text without any Font tag attribute value</p> <p> <font>Text having normal font size and font face . Only changing font color </font> </p> <p> <font face="cursive">Text having different font face.</font> </p> <p> <font>Text with Increased font size having default font type. </font> </p>Code:
Output:
Example #2
Define the font tag with its attribute value defined through CSS:
<title>Font Tag in HTML</title> <h2 id="Example-of-Font-Tag-in-HTML-using-CSS">Example of Font Tag in HTML using CSS </h2> <p>Someone’s sitting in the shade today because someone plated a tree a long time ago. </p> <p style="color : lightgreen;"> Someone’s sitting in the shade today because someone plated a tree a long time ago. </p> <p style="font-family : Book Antiqua; color: blue; "> Someone’s sitting in the shade today because someone plated a tree a long time ago. </p> <p style="font size:3px;"> Someone’s sitting in the shade today because someone plated a tree a long time ago. </p>Code:
Output:
Example #3
In this example, we are using a Font tag with attribute value size, which will define text from lowest size to highest size as shown below:
<title>HTML font tag</title> <font size="1">People may doubt what you say, but they will believe what you do.</font><br> <br> <font size="2">People may doubt what you say, but they will believe what you do.</font><br> <br> <font size="3">People may doubt what you say, but they will believe what you do.</font><br> <br> <font size="4">People may doubt what you say, but they will believe what you do.</font><br> <br> <font size="5">People may doubt what you say, but they will believe what you do.</font><br> <br> <font size="6">People may doubt what you say, but they will believe what you do.</font><br><br> <font size="7">People may doubt what you say, but they will believe what you do.</font>HTML Code:
Output:
Example #4
<title>HTML tag with Font Type attribute</title> <font face="Comic sans MS"> Correct one fault at a time. Concentrate on the one fault you want to overcome.</font><br> <font face="Bernard MT Condensed" color="Red">Correct one fault at a time. Concentrate on the one fault you want to overcome. </font><br> <font face="Algerian">Correct one fault at a time. Concentrate on the one fault you want to overcome. </font><br> <font face="Book Antiqua" size="5">Correct one fault at a time. Concentrate on the one fault you want to overcome. </font><br> <font face="Aharoni"> Correct one fault at a time. Concentrate on the one fault you want to overcome.</font><br> <font face="AR BERKLEY">Correct one fault at a time. Concentrate on the one fault you want to overcome. </font><br>HTML Code:
Output:
Example #5
<title>HTML Font tag-Color </title> <font color="#cc0066"><b>It is terrible thing to see and have no vision</b></font><br> <font color="#66ff33"><b>Today's preparation </b></font> <br> <font color="#0000cc"><strong>Success depends on your backbone not your wishbone.</strong></font><br> <font color="#cc3300"><b>Patience makes lighter what sorrow may not heal</b></font> <br> <font color="#666600"><b>Hold fast to dreams, for if dreams die, life is broken winged bird that cannot fly </b></font> <br>HTML Code:
Output:
- Conclusion
- It is used to display text in the same size, color and face format. The font tag is going to displayed by using .. tag.
The above is the detailed content of Font Tag in HTML. For more information, please follow other related articles on the PHP Chinese website!

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

HTMLisaspecifictypeofcodefocusedonstructuringwebcontent,while"code"broadlyincludeslanguageslikeJavaScriptandPythonforfunctionality.1)HTMLdefineswebpagestructureusingtags.2)"Code"encompassesawiderrangeoflanguagesforlogicandinteract

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.