How to use CSS Styles In HTML

The <b> tag makes text bold, while <strong> adds semantic importance, typically displaying as bold by default. Incorporating these tags improves readability and user engagement. The <p> tags enclose paragraphs of text, while inline styles defined with the style attribute modify their appearance. By specifying properties like color and font size directly within the tag, precise styling adjustments are achieved without the need for external CSS files.

Example: The example shows the above-explained approach.

HTML
<!DOCTYPE html>
<html>

<body>

    <p>I am normal</p>
    <p style="color:red;">I am red</p>
    <p style="color:blue;">I am blue</p>
    <p style="font-size:50px;">I am big</p>
    <p>Hello <b>GFG</b></p>
</body>

</html>

Output:

Using inline css

How to Style Text in HTML?

The HTML style attribute adds styles to an element, such as color, font, size, and more. Here, we are going to learn how to style Text in HTML.

These are the following methods:

Table of Content

  • Using CSS Styles
  • Using Element for Styling

Similar Reads

Using CSS Styles

The tag makes text bold, while adds semantic importance, typically displaying as bold by default. Incorporating these tags improves readability and user engagement. The

tags enclose paragraphs of text, while inline styles defined with the style attribute modify their appearance. By specifying properties like color and font size directly within the tag, precise styling adjustments are achieved without the need for external CSS files....

Using Element for Styling

is used to semantically indicate strong importance. is used to semantically indicate emphasis. is used to underline text. is used for bold text styling, similar to but carries no semantic meaning....

Contact Us