Skip to content

Inline style HTML | Apply CSS rules directly into the start tag

  • by

Using Inline style in HTML webpage you can apply the unique style rules to an element ( <p>, <div>, <a>, etc). The style attribute includes a series of CSS property and value pairs. Each property: value pair is separated by a semicolon (;).

Note: The style attribute will override any style set globally (Internal or External CSS)

Syntax

<element style="style_definitions">

OR

<tag style="color: blue;....">

Example of Inline style HTML

Here’s a basic example of HTML page using inline styles:

In code the p tag with the inline style attribute to change font color and size.

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

Output:

Example of Inline style HTML

The inline style HTML attributes:-

One or more CSS properties and values separated by semicolons (e.g. style=”color:red; text-align:left”)

Style attributes are: property and value.

 inline style HTML attributes

Do comment if you have any questions and suggestions on this article.

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

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading