Text Formatting Tags
Yaser Rahmati | یاسر رحمتی
HTML provides several tags to format and style text. Here’s an overview of the most commonly used text formatting tags.
1. Bold Text
Use the
<b>
tag to make text bold. This tag doesn’t add emphasis but makes the text bold visually.Use the
<strong>
tag to indicate that the text is important, which also makes the text bold but has a semantic meaning.Syntax:
Example:
2. Italic Text
Use the
<i>
tag to italicize text. It is mainly used for stylistic purposes.Use the
<em>
tag to emphasize text, which also italicizes it but conveys importance.Syntax:
Example:
3. Underlined Text
The
<u>
tag is used to underline text.Syntax:
Example:
4. Strikethrough Text
The
<s>
tag creates strikethrough text, meaning the text will appear with a line through it, indicating it is incorrect or no longer relevant.Syntax:
Example:
5. Subscript and Superscript
Use the
<sub>
tag to display text as a subscript (below the normal text).Use the
<sup>
tag to display text as a superscript (above the normal text).Syntax:
Example:
6. Monospaced Text
Use the
<code>
tag for displaying code in a monospaced font, often used in programming examples.Use the
<pre>
tag to preserve both spaces and line breaks, which is useful for preformatted text.Syntax:
Example:
7. Highlighted Text
The
<mark>
tag highlights text, typically with a yellow background.Syntax:
Example:
8. Small Text
The
<small>
tag reduces the size of the text, often used for fine print.Syntax:
Example:
9. Quotation and Citation
Use the
<q>
tag to create inline quotes.Use the
<blockquote>
tag for longer, block-level quotations.Use the
<cite>
tag to reference the source of a quotation.Syntax:
Example:
Full Example Using Formatting Tags
This guide introduces the essential text formatting tags in HTML, allowing you to control the appearance of your content.
Keywords
HTML
, Hypertext Markup Language
, Tags
, Elements
, Attributes
, Head
, Body
, Paragraph
, Heading
, Title
, Meta
, Link
, Image
, Anchor
, Hyperlink
, List
, Table
, Form
, Input
, Button
, CSS
, Class
, ID
, Inline
, Block
, Div
, Span
, Script
, Styles
, Font
, Color
, Background
, Margin
, Padding
, Border
, Doctype
, HTML5
, Video
, Audio
, Canvas
, SVG
External Links
🌐 Personal Website 📄 Resume 🎥 Video Archive 💼 Finance Blog 🔐 Network & Security Notebook 🎬 Aparat Channel
Last updated