/    /  Inline CSS

Inline CSS

 

Inline CSS is used to apply CSS on a unique style for a single line or element.

The inline CSS is also a method to insert style sheets (CSS) in the HTML document. This method mitigates some benefits of style sheets so it is advised to use this method sparingly.

 

Example:

 

<!DOCTYPE html>
<html>
<body>
<h1 style="color:red;margin-left:40px;">Inline CSS is applied on this heading.</h1>
<p>paragraph is not affected.</p>
</body>
</html>

 

OUTPUT:

 

Inline CSS

 

Disadvantages of Inline CSS:

 

  • You cannot use quotations within inline CSS(end of your style value).
  • These inline styles cannot be reused anywhere else.
  • These inline styles are tough to be edited because they are not stored in a single place.