Thursday, June 13, 2024

HTML-BASIC FORMATTING TAGS

HTML basic formatting tags are essential for structuring and styling text content within a web page. Below is an overview of these tags, categorized by their functions: basic tags, formatting tags, and color coding.

HTML Basic Tags

  1. Paragraph

    • <p>: Defines a paragraph.


      <p>This is a paragraph.</p>
  2. Headings

    • <h1> to <h6>: Defines HTML headings, where <h1> is the highest (or most important) level and <h6> is the lowest.


      <h1>This is a heading 1</h1> <h2>This is a heading 2</h2>
  3. Line Break

    • <br>: Inserts a single line break.


      <p>This is a line.<br>This is another line.</p>
  4. Horizontal Rule

    • <hr>: Inserts a horizontal rule (a thematic break).


      <hr>

HTML Formatting Tags

  1. Bold

    • <b>: Defines bold text.


      <b>This text is bold</b>
  2. Italic

    • <i>: Defines italic text.


      <i>This text is italic</i>
  3. Underline

    • <u>: Defines underlined text.


      <u>This text is underlined</u>
  4. Strong

    • <strong>: Defines important text (typically rendered as bold).


      <strong>This text is strong</strong>
  5. Emphasis

    • <em>: Defines emphasized text (typically rendered as italic).


      <em>This text is emphasized</em>
  6. Small

    • <small>: Defines smaller text.


      <small>This text is small</small>
  7. Subscript

    • <sub>: Defines subscripted text.


      H<sub>2</sub>O
  8. Superscript

    • <sup>: Defines superscripted text.


      E=mc<sup>2</sup>
  9. Mark

    • <mark>: Defines marked or highlighted text.


      <mark>This text is marked</mark>
  10. Deleted Text

    • <del>: Defines deleted (struck-through) text.


      <del>This text is deleted</del>
  11. Inserted Text

    • <ins>: Defines inserted (underlined) text.


      <ins>This text is inserted</ins>
  12. Code

    • <code>: Defines a piece of computer code.


      <code>let x = 5;</code>

HTML Color Coding

  1. Text Color

    • Using the style attribute with the color property to set the color of text.


      <p style="color: red;">This text is red.</p> <p style="color: #00FF00;">This text is green.</p>
  2. Background Color

    • Using the style attribute with the background-color property to set the background color.


      <p style="background-color: yellow;">This text has a yellow background.</p> <p style="background-color: #0000FF;">This text has a blue background.</p>
  3. Color Names and Codes

    • Colors can be specified by name, hex code, RGB, RGBA, HSL, and HSLA values.


      <p style="color: blue;">Color by name</p> <p style="color: #ff6347;">Color by hex code</p> <p style="color: rgb(255, 99, 71);">Color by RGB</p> <p style="color: rgba(255, 99, 71, 0.5);">Color by RGBA</p> <p style="color: hsl(9, 100%, 64%);">Color by HSL</p> <p style="color: hsla(9, 100%, 64%, 0.5);">Color by HSLA</p>

Here's an example HTML document using some of these basic formatting tags:


<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>HTML Basic Formatting Example</title> </head> <body> <h1>This is a Heading 1</h1> <h2>This is a Heading 2</h2> <p>This is a paragraph with <b>bold</b>, <i>italic</i>, and <u>underlined</u> text.</p> <p>This text is <strong>strong</strong> and this is <em>emphasized</em>.</p> <p><small>This is smaller text.</small></p> <p>This is subscript: H<sub>2</sub>O and this is superscript: E=mc<sup>2</sup>.</p> <p><mark>This text is highlighted.</mark></p> <p><del>This text is deleted</del> and <ins>this text is inserted</ins>.</p> <p>This is a line of <code>code</code>.</p> <p style="color: red;">This text is red.</p> <p style="background-color: yellow;">This text has a yellow background.</p> </body> </html>

This document covers the use of basic tags, formatting tags, and color coding within HTML.

 

No comments:

Post a Comment