02 / 03

What are the different ways in which we can include CSS in our HTML file?

CSS can be added to HTML in several ways depending on how you want to structure and maintain your styles. Each method has its use case, from quick inline styling to full-scale external stylesheets.

Different Ways to Include CSS
  1. 1

    Inline CSS: Added directly within an HTML element using the 'style' attribute.

  2. 2

    Internal CSS: Written inside a <style> tag within the <head> section of the HTML document.

  3. 3

    External CSS: Written in a separate .css file and linked to the HTML document using a <link> tag in the <head>.

  4. 4

    Imported CSS: Brought into another CSS file using the '@import' rule.

Examples of Each Method