Professional Documents
Culture Documents
HTML Text Formatting - GeeksforGeeks
HTML Text Formatting - GeeksforGeeks
HTML Tutorial HTML Exercises HTML Tags HTML Attributes Global Attributes Event Attributes HTML Inter
Text Formatting can be categorized into 2 techniques, i.e., the logical tag
where the tags denote the logical or semantic value of the text, and the
Physical tag, which denotes the visual appearance of the text.
Table of Content
HTML Formatting Elements
Making text Bold or Strong
Making text Italic or emphasize
Highlighting a Text
Making a text as Subscript or Superscript
Making text smaller
Striking through the text
Adding a Text
Supported Browsers
Tags Descriptions
https://www.geeksforgeeks.org/html-text-formatting/?ref=lbp 1/14
4/1/24, 5:05 AM HTML Text Formatting - GeeksforGeeks
Tags Descriptions
Example: This example display text in HTML strong, small, and Highlight
formatting respectively.
HTML
<!DOCTYPE html>
https://www.geeksforgeeks.org/html-text-formatting/?ref=lbp 2/14
4/1/24, 5:05 AM HTML Text Formatting - GeeksforGeeks
<html>
<head>
<title>
HTML text formatting
</title>
</head>
<body>
<h2>Welcome To GeeksforGeeks</h2>
<!--Text in Strong-->
<strong>Hello Geeks</strong>
<br>
<!--Text in small-->
<small>Hello Geeks</small>
<br>
<!--Text in Highlight-->
<mark>Hello Geeks</mark>
</body>
</html>
Output:
Example 1: The below example describes the formatting of the text to normal,
bold, & strong.
HTML
<!DOCTYPE html>
https://www.geeksforgeeks.org/html-text-formatting/?ref=lbp 3/14
4/1/24, 5:05 AM HTML Text Formatting - GeeksforGeeks
<html>
<head>
<title>HTML bold Text</title>
</head>
<body>
<!--Normal text-->
<p>Hello GeeksforGeeks</p>
<!--Text in Bold-->
<p>
<b>Hello GeeksforGeeks</b>
</p>
<!--Text in Strong-->
<p>
<strong>Hello GeeksforGeeks</strong>
</p>
</body>
</html>
Output:
Example 2: The below example describes the formatting of the text to Italic or
emphasize.
HTML
<!DOCTYPE html>
<html>
<head>
<title>HTML italic formatting</title>
</head>
https://www.geeksforgeeks.org/html-text-formatting/?ref=lbp 4/14
4/1/24, 5:05 AM HTML Text Formatting - GeeksforGeeks
<body>
<!--Normal text-->
<p>Hello GeeksforGeeks</p>
<!--Text in Italics-->
<p>
<i>Hello GeeksforGeeks</i>
</p>
<!--Text in Emphasize-->
<p>
<em>Hello GeeksforGeeks</em>
</p>
</body>
</html>
Output:
Highlighting a Text
It is also possible to highlight a text in HTML using the <mark> tag. It has an
opening tag <mark> and a closing tag </mark>.
Example: The below example describes the use of the <mark> tag that is used
to define the marked text.
https://www.geeksforgeeks.org/html-text-formatting/?ref=lbp 5/14
4/1/24, 5:05 AM HTML Text Formatting - GeeksforGeeks
HTML
<!DOCTYPE html>
<html>
<head>
<title>Highlight the text in HTML</title>
</head>
<body>
<!--Text in Normal-->
<p>Hello GeeksforGeeks</p>
<!--Text in Highlight-->
<p>
<mark>Hello GeeksforGeeks</mark>
</p>
</body>
</html>
Output:
Using Tag
Example: The below example describes the use of the <sup> & <sub> tags
that are used to add the superscript & subscript texts to the HTML document.
HTML
<!DOCTYPE html>
<html>
<head>
<title>Superscript and Subscript</title>
</head>
<body>
<!--Text in Normal-->
https://www.geeksforgeeks.org/html-text-formatting/?ref=lbp 6/14
4/1/24, 5:05 AM HTML Text Formatting - GeeksforGeeks
<p>Hello GeeksforGeeks</p>
<!--Text in Superscript-->
<p>Hello
<sup>GeeksforGeeks</sup>
</p>
<!--Text in Subscript-->
<p>Hello
<sub>GeeksforGeeks</sub>
</p>
</body>
</html>
Output:
Example: The below example describes the use of the <small> tag that is
used to set small font sizes.
HTML
<!DOCTYPE html>
<html>
<head>
<title>HTML <small></title>
</head>
<body>
https://www.geeksforgeeks.org/html-text-formatting/?ref=lbp 7/14
4/1/24, 5:05 AM HTML Text Formatting - GeeksforGeeks
<!--Text in Normal-->
<p>Hello GeeksforGeeks</p>
<!--Text in small-->
<p>
<small>Hello GeeksforGeeks</small>
</p>
</body>
</html>
Output:
Using Tag
Example: The below example describes the use of the <del> tag that is used
to mark a portion of text which has been deleted from the document.
HTML
<!DOCTYPE html>
<html>
<head>
<title>HTML striking </title>
</head>
<body>
<!--Text in Normal-->
<p>Hello GeeksforGeeks</p>
<!--Text in Delete-->
<p> <del>Hello GeeksforGeeks</del> </p>
</body>
</html>
Output:
https://www.geeksforgeeks.org/html-text-formatting/?ref=lbp 8/14
4/1/24, 5:05 AM HTML Text Formatting - GeeksforGeeks
Using Tag
Adding a Text
The <ins> element is used to underline a text marking the part as inserted or
added. It also has an opening and a closing tag.
Example: This example describes the use of the <ins> tag to used to specify a
block of inserted text.
HTML
<!DOCTYPE html>
<html>
<head>
<title>Inserting the text in HTML</title>
</head>
<body>
<!--Text in Normal-->
<p>Hello GeeksforGeeks</p>
<!--Text in Insert-->
<p>
<ins>Hello GeeksforGeeks</ins>
</p>
</body>
</html>
Output:
Using tag
Supported Browsers
Google Chrome 1
Microsoft Edge 12
Firefox 1
https://www.geeksforgeeks.org/html-text-formatting/?ref=lbp 9/14
4/1/24, 5:05 AM HTML Text Formatting - GeeksforGeeks
Opera 12.1
Safari 1
“This course was packed with amazing and well-organized content! The
project-based approach of this course made it even better to understand
concepts faster. Also the instructor in the live classes is really good and
knowledgeable.”- Tejas | Deutsche Bank
With our revamped Full Stack Development Program: master Node.js and
React that enables you to create dynamic web applications.
So get ready for salary hike only with our Full Stack Development Course.
Previous Next
Similar Reads
HTML Text Formatting Elements CSS Text Formatting
What are the various formatting tags How to select all text in HTML text input
available in HTML ? when clicked using JavaScript?
How to create long shadow of text Text Animation with changing the color
without using text-shadow in HTML and of the text using HTML and CSS
CSS ?
https://www.geeksforgeeks.org/html-text-formatting/?ref=lbp 10/14
4/1/24, 5:05 AM HTML Text Formatting - GeeksforGeeks
C Chinmoy …
Company Explore
About Us Hack-A-Thons
Legal GfG Weekly Contest
Careers DSA in JAVA/C++
In Media Master System Design
Contact Us Master CP
Advertise with us GeeksforGeeks Videos
GFG Corporate Solution Geeks Community
Placement Training Program
https://www.geeksforgeeks.org/html-text-formatting/?ref=lbp 11/14
4/1/24, 5:05 AM HTML Text Formatting - GeeksforGeeks
Languages DSA
Python Data Structures
Java Algorithms
C++ DSA for Beginners
PHP Basic DSA Problems
GoLang DSA Roadmap
SQL Top 100 DSA Interview Problems
R Language DSA Roadmap by Sandeep Jain
Android Tutorial All Cheat Sheets
Tutorials Archive
https://www.geeksforgeeks.org/html-text-formatting/?ref=lbp 13/14
4/1/24, 5:05 AM HTML Text Formatting - GeeksforGeeks
https://www.geeksforgeeks.org/html-text-formatting/?ref=lbp 14/14