Ways to Insert CSS

Written by

Aayushi Bansal

There are three ways to insert CSS:

  • Inline style
  • Internal style sheet
  • External style sheet

Inline styles:

It is used to apply a unique style to a single HTML element. To use it, we should add the style attribute to the desired element and this style attribute can have any number of property-value pairs. For example,

<p style="color: red; margin-left:40px;">This is a paragraph</p>

Internal style sheet:

Internal style sheet is used when one single page has a unique style. It is added in the head section of an HTML page and internal styles are defined within the