HTML - Text Formatting

Text Formatting:

  • In HTML, we have various elements to format text with special meaning. Such various elements are
    • Font <font>
    • Font Styles
    • Font Effects
Font <font> Element:
  • It defines the appearance of text on the web page by changing the font, size, and color.

Attribute  Description
Face Defines the font family like Arial, Times new roman, etc.,
Size Defines the character size in 7 levels. Default is 3 and can be increased gradually from 1 to 7 levels.
Color Specifies a color name or code.
    <font face="arial" size="5" color="blue"> HTML Course - Geek4Tutorial </font>
Font Styles:
  • In HTML, we can display special types of text like bold or italic using the below tags.
Style Tag name
Bold <b> - Bold, <strong> - Strong
Italic <i> - Italic,  <em> - Emphasized
  • <strong> - defines text with importance and content is displayed in bold.
  • <em> - defines an emphasized text and content is displayed in italics.

    <b> Content in bold </b>
    <strong> Important text and displayed in bold </strong>
    <i> Content in italics </i>
    <em> Emphasized texxt and diplayed in italics </em>

Font effects:
  • The font effects will change the character display mode by highlighting or changing the position raised or lowered from baseline.
  • The tags used for font effects are
    • <u> - Underline
    • <ins> - Inserted
    • <strike> - Strikeout
    • <del> - Deleted
    • <sup> - Superscript
    • <sub> - Subscript
  • <u> - displays the content inside with an underline.

    <p>This text is <u>underlined</u> text.</p>

  • <ins> - defines a text that has been inserted into a document and content is displayed with an underline.

    <p>HTML latest version is <del>HTML4</del> <ins>HTML5</ins>.</p>

  • <strike> - This is not supported in HTML5. Used in HTML4 to define a strikethrough text.
  • <del> - defines a text that has been deleted from the document and content is displayed with strike a line through the deleted text.

    <p>HTML latest version is <del>HTML4</del> HTML5.</p>

  • <sub> - define a subscript text that appears half a character below the baseline with a smaller font. This can be used for some chemical and mathematical formulas.

    <p>This is <sub>subscripted</sub> text.</p>

  • <sup> - defines a superscript text that appears half a character above the baseline with a smaller font.

    <p>This is <sup>superscripted</sup> text.</p>

No comments:

Post a Comment

You might also like

Deploy your Django web app to Azure Web App using App Service - F1 free plan

In this post, we will look at how we can deploy our Django app using the Microsoft Azure app service - a free plan. You need an Azure accoun...