Introduction
HTML, or Hypertext Markup Language, is the primary language for structuring web pages. It collaborates with CSS and JavaScript to define content, appearance, and behavior. HTML comprises elements enclosed in angle brackets, encompassing various webpage components like headings, paragraphs, images, and links. The standard structure includes the , , and elements. HTML facilitates hyperlink creation through the tag, enabling seamless navigation between web pages. HTML5, the latest version, introduces new elements and attributes, enhancing web functionality and accessibility. In essence, HTML serves as the foundation for creating structured, interactive web content, essential for web development and design.

Text formatting with HTML
About Lesson

Text formatting in HTML allows you to control the appearance and styling of text content on your web pages. Here are some common text formatting techniques using HTML:

1. **Heading Tags (h1 – h6):**
– HTML provides six levels of headings, ranging from `<h1>` (the largest) to `<h6>` (the smallest).
– Headings are used to indicate the importance and hierarchy of different sections of content on a web page.
– Example:
“`html
<h1>This is a Heading Level 1</h1>
<h2>This is a Heading Level 2</h2>
“`

2. **Paragraphs (p):**
– The `<p>` tag is used to define paragraphs of text.
– Paragraphs are block-level elements that create space above and below the content.
– Example:
“`html
<p>This is a paragraph of text.</p>
“`

3. **Bold (b) and Italic (i):**
– The `<b>` tag is used to make text bold.
– The `<i>` tag is used to make text italic.
– These tags are mainly used for emphasizing text.
– Example:
“`html
<b>This text is bold</b>
<i>This text is italic</i>
“`

4. **Underline (u) and Strikethrough (s):**
– The `<u>` tag is used to underline text.
– The `<s>` tag is used to create a strikethrough effect.
– These effects are less commonly used due to modern design trends.
– Example:
“`html
<u>This text is underlined</u>
<s>This text has a strikethrough</s>
“`

5. **Superscript (sup) and Subscript (sub):**
– The `<sup>` tag is used to create superscript text (text appearing above the normal line).
– The `<sub>` tag is used to create subscript text (text appearing below the normal line).
– Example:
“`html
E = mc<sup>2</sup>
H<sub>2</sub>O
“`

6. **Font Size and Color:**
– The `<font>` tag (deprecated in HTML5) can be used to specify font size and color.
– It’s recommended to use CSS for styling instead of the `<font>` tag.
– Example:
“`html
<font size=”4″ color=”blue”>This text is blue and size 4</font>
“`

These are some basic text formatting techniques in HTML. However, for modern web development, it’s advisable to use CSS (Cascading Style Sheets) for styling purposes, as it provides more flexibility and control over the appearance of text and other elements on your web pages.

Join the conversation