Ad Code

Responsive Advertisement

html coding - Part 5 - HTML Text Formatting

 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
HTML
<h1>Main Heading</h1>
<p>This is a <b>bold</b> and <i>italic</i> text.</p>
<ul>
	<li>Item 1</li>
	<li>Item 2</li>
</ul>
<p align="center">This text is centered.</p>
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.

Post a Comment

0 Comments


Ad Code

Responsive Advertisement