HTML Tutorial
HTML XHTML
HTML Media
HTML Advanced
Here's a tutorial on HTML text formatting:
HTML (Hypertext Markup Language) provides various tags and attributes to format text on a web page. Text formatting can be used to make the content more readable, visually appealing, and easier to understand. Here are some common text formatting tags in HTML:
<b>
and <strong>
The <b>
tag and <strong>
tag are used to make text bold. The <strong>
tag is used to indicate that the text is important, while the <b>
tag is used for generic bold text. For example:
<strong>This text is important!</strong> <b>This text is bold!</b>
<i>
and <em>
The <i>
tag and <em>
tag are used to make text italicized. The <em>
tag is used to indicate emphasis, while the <i>
tag is used for generic italicized text. For example:
<em>This text is emphasized!</em> <i>This text is italicized!</i>
<u>
The <u>
tag is used to underline text. For example:
<u>This text is underlined!</u>
<del>
The <del>
tag is used to strike through text to indicate that it has been deleted or removed. For example:
<del>This text has been removed.</del>
<ins>
The <ins>
tag is used to underline text and highlight it with a background color to indicate that it has been added or inserted. For example:
<ins>This text has been added.</ins>
<sup>
and <sub>
The <sup>
tag and <sub>
tag are used to make text superscript and subscript, respectively. The <sup>
tag is used for text that should be raised above the baseline, while the <sub>
tag is used for text that should be lowered below the baseline. For example:
E = mc<sup>2</sup> H<sub>2</sub>O
By using HTML text formatting tags, you can make your content more visually appealing and easier to understand. You can also use CSS (Cascading Style Sheets) to further customize the appearance of your text formatting.
HTML text formatting tags:
HTML provides various tags for formatting text, such as <strong>
, <em>
, <u>
, <s>
, <sub>
, and <sup>
.
<p>This is <strong>strong</strong> text and <em>emphasized</em> text.</p>
HTML bold and italic text:
Use the <strong>
tag for bold and <em>
tag for italic text.
<p>This is <strong>bold</strong> and <em>italic</em> text.</p>
Underlining text in HTML:
Use the <u>
tag to underline text.
<p>This is <u>underlined</u> text.</p>
HTML strikethrough text:
Strikethrough text using the <s>
tag.
<p>This is <s>strikethrough</s> text.</p>
Subscript and superscript in HTML:
Use <sub>
for subscript and <sup>
for superscript.
<p>H<sub>2</sub>O is water. 10<sup>2</sup> is 100.</p>
HTML line breaks and paragraphs:
Create line breaks with <br>
and paragraphs with <p>
.
<p>This is a paragraph.<br>This is a new line.</p>
Changing font size in HTML:
Use the <span>
tag with CSS for font size adjustments.
<p>This is <span style="font-size: 20px;">large</span> text.</p>
HTML text color styling:
Apply color to text using the <span>
tag with CSS.
<p>This is <span style="color: blue;">blue</span> text.</p>
HTML text alignment:
Align text with the text-align
property.
<p style="text-align: center;">Centered text.</p>
Adding spacing between lines in HTML:
Use the line-height
property to adjust line spacing.
<p style="line-height: 1.5;">This has increased line spacing.</p>
HTML preformatted text:
Use the <pre>
tag for preformatted text.
<pre> This is preformatted text. </pre>
HTML blockquote text formatting: Apply formatting to blockquotes.
<blockquote style="font-style: italic; color: #888;">This is a formatted quote.</blockquote>
HTML text indentation:
Indent text using the text-indent
property.
<p style="text-indent: 20px;">This is indented text.</p>
HTML text decoration options:
Decorate text using the text-decoration
property.
<p style="text-decoration: underline;">Underlined text.</p>
HTML text transform property:
Transform text using the text-transform
property.
<p style="text-transform: uppercase;">Uppercase text.</p>
Creating lists in HTML:
Use <ul>
, <ol>
, and <li>
for unordered and ordered lists.
<ul> <li>Item 1</li> <li>Item 2</li> </ul> <ol> <li>First</li> <li>Second</li> </ol>
HTML text shadow effects:
Apply text shadow using the text-shadow
property.
<p style="text-shadow: 2px 2px 4px #888;">Text with shadow.</p>
Responsive text formatting in HTML: Use media queries for responsive text formatting.
@media (max-width: 600px) { p { font-size: 14px; } }
HTML letter and word spacing:
Adjust letter and word spacing using the letter-spacing
and word-spacing
properties.
<p style="letter-spacing: 2px; word-spacing: 5px;">Spaced out text.</p>
HTML code formatting for text:
Use the <code>
tag for inline code and <pre>
for block code.
<p>This is <code>inline code</code>.</p> <pre> Block of code Line 1 Line 2 </pre>