HTML Text Formatting
HTML provides several elements to format text, making it more readable and visually appealing.
Headings
<h1>
: Main heading (largest font size)<h2>
: Subheading (smaller font size)<h3>
: Sub-subheading (even smaller font size)- ...
<h6>
: Smallest heading (smallest font size)
Text Emphasis
<b>
: Bold text<i>
: Italic text<u>
: Underlined text<s>
: Strikethrough text<em>
: Emphasized text (italicized)<strong>
: Strongly emphasized text (bolded)
Text Alignment
<p align="left">
: Left-aligned text<p align="center">
: Centered text<p align="right">
: Right-aligned text<p align="justify">
: Justified text
Lists
<ul>
: Unordered list (bulleted)<ol>
: Ordered list (numbered)<li>
: List item
Other Text Formatting Elements
<sub>
: Subscript text<sup>
: Superscript text<code>
: Code text (monospaced font)<kbd>
: Keyboard input text (monospaced font)<pre>
: Preformatted text (preserves whitespace)
Example HTML Text Formatting
Best Practices
- Use headings to create a clear document structure.
- Use text emphasis elements to draw attention to important text.
- Use lists to present information in a clear and concise manner.
0 Comments