Advertisement

Responsive Advertisement

Format and Text styling Tags

Format and Text

Format And Text Style Tags

Font Tag Attributes

The <font> tag in HTML has several attributes that can be used to specify the font properties. Here are some of the most commonly used font tag attributes:

  1. Size: Specifies the font size, ranging from 1 to 7, with 3 being the default.
  2. Color: Specifies the font color, using a hexadecimal code or a color name.
  3. Face: Specifies the font family, such as Arial, Times New Roman, or Courier.
  4. Style: Specifies the font style, such as italic, bold, or underline.
Example: <font size="5" color="red" face="Arial" style="italic">Text</font>

Types of HTML Tags for Text Formatting

HTML has various types of format and style text tags that can be used to display text in different styles. Some of the most common ones are:

  1. <p> - Paragraph: Used for paragraphs of text. </p>
  2. <u> - Underline: Used to underline text. </u>
  3. <i> - Italic: Used to italicize text. </i>
  4. <em> - Emphasis: It emphasizes text (new standard for italic). </em>
  5. <b> - Bold: Used to make text bold. </b>
  6. <strong> - Strong: Used to make text strong (new standard for bold). </strong>
  7. <s> - Strike: Used to strike through text. </s>
  8. <mark> - Mark: Used to highlight text. </mark>
  9. <del> - Delete: Used to show deleted text. </del>
  10. <small> - Small: Used to make text smaller. </small>
  11. <sub> - Subscript: Used for subscripts (e.g., H2O). </sub>
  12. <sup> - Superscript: Used for superscripts (e.g., x2). </sup>

----------- Exercise ---------

<html>
<head>
<title>Text Formatting Example</title>
</head>
<body>
<p>This is a Paragraph.</p>
<u>This is Underlined text.</u>
<i>This is Italic text.</i>
<em>This is Emphasized text.</em>
<b>This is Bold text.</b>
<s>This is Strikethrough text.</s>
<mark>This is Highlighted text.</mark>
<del>This is Deleted text.</del>
<small>This is Smaller text.</small>
<sub>This is Subscript text: H<sub>2</sub>O</sub>
<sup>This is Superscript text: x<sup>2</sup></sup>
</body>
</html>

Inline vs Block-level Elements

HTML elements can be categorized into inline and block-level elements:

  • Inline elements: These elements do not start on a new line and only take up as much width as necessary. Examples: <i>, <b>, <mark>
  • Block-level elements: These elements start on a new line and take up the full width available. Examples: <p>, <div>, <h1>

Post a Comment

0 Comments