w1coding.comAll tutorials

HTML Formatting

HTML lessons
  1. Environment Setup
  2. Introduction
  3. Basics
  4. Editors
  5. Elements
  6. Attributes
  7. Heading
  8. Paragraphs
  9. Styles
  10. Formatting
  11. Quotations
  12. Comment
  13. Colors
  14. CSS
  15. Links
  16. Images
  17. Favicon
  18. Title
  19. Tables
  20. Block And Inline
  21. Lists
  22. Div
  23. Classes
  24. ID
  25. Iframes
  26. Responsive

What is HTML Formatting?

HTML formatting refers to the way text is presented on a webpage. It includes the use of various tags to style and structure text, such as making text bold, italic, or creating lists. Proper formatting enhances readability and helps convey information effectively.

Common Text Formatting Tags

  • Bold Text: Use the <strong> tag to make text bold.
  • <strong>This text is bold.</strong>
  • Italic Text: Use the <em> tag to italicize text.
  • <em>This text is italic.</em>
  • Underlined Text: Use the <u> tag to underline text.
  • <u>This text is underlined.</u>
  • Strikethrough Text: Use the <del> tag to create strikethrough text.
  • <del>This text is strikethrough.</del>

Semantic Formatting

Semantic HTML elements give meaning to the content, improving accessibility and SEO. Here are some important semantic tags:

  • <blockquote>: Used for quoting text from another source.
  • <blockquote>This is a quote.</blockquote>
  • <cite>: Used to reference the title of a work.
  • <cite>Title of the Work</cite>
  • <code>: Used to define a piece of computer code.
  • <code>console.log("Hello, World!");</code>
  • <mark>: Used to highlight text.
  • <mark>This text is highlighted.</mark>

Best Practices for Using HTML Formatting

  • Use formatting tags appropriately to enhance readability without overdoing it.
  • Avoid using deprecated tags like <b> and <i> in favor of <strong> and <em> for better semantic meaning.
  • Ensure that your formatting choices support accessibility; use semantic tags that provide context to screen readers.
  • Keep your HTML clean and organized by using formatting tags consistently and sparingly.