Inline CSS

Inline CSS

When we write inline styles, we write the CSS in the HTML file, directly inside an element's tag using a style attribute.

An inline style may be used to apply a unique style for a single element.

To use inline styles, add the style attribute to the relevant element. The style attribute can contain any CSS property.

Syntax:

<htmltag style="cssproperty1:value; cssproperty2:value;"></htmltag>

Example:

  
   <!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1 style = "color:blue;">This is inline CSS </h1>
</body>
</html>
Try it with the Editor

Disadvantages of Inline CSS