Different ways to add CSS to your webpages

Different ways to add CSS to your webpages

How can you add CSS properties to your HTML webpage?

Well, there are multiple ways –

  • External CSS –

This basically means that we are going to write our CSS in a separate file (let’s call it a style sheet), which would have an extension of .css, and we are going to have a reference to this stylesheet in our HTML page so that it can be applied to the elements.

  • Internal CSS –

Here, we would be writing the CSS in the HTML file only, within the <style> element, in the head section.

  • Inline CSS –

This basically means that we are going to write our CSS, with help of the style attribute, for some particular element in the HTML file. This styling that we write is basically for some particular element.

We are first going to learn about the inline CSS, in which, we will be using the style attribute in some elements for applying styles to it, and then we will have a look at internal CSS, and then the External CSS. Let’s have a look at them one by one.