Skip to content

HTML style attribute in Tag | Example code

  • by

HTML style attribute is used to style an specific elements (tag) in webpage. It will override the other CSS (External CSS).

Inline CSS method use style attribute inside the HTML start tag.

Note: The style attribute can be used on any HTML element ( < p >, < div >, < a >, etc).

Example of HTML style attribute

The style attribute includes a series of CSS properties and value pairs. Each ‘ property : value ‘ pair is separated by a semicolon ( ; ).

Code line

<p style="color:blue;font-size:46px;">

Complete Example code

<!DOCTYPE html>
<html>
  <body>
    <p style="color:blue;font-size:46px;">
      I'm a big, blue, paragraph
    </p>
  </body>
</html>

Output:

Example of HTML style attribute

Do comment if you have any doubts and suggestion on this HTML topic.

Note: The All HTML Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Your email address will not be published. Required fields are marked *