CSS Types


Type of Style Sheet

There are three types of CSS. you can see the following types of CSS.

  • External CSS
  • Internal CSS
  • Inline CSS

External CSS

The CSS uses the element in a separate file, called an external stylesheet, to handle the CSS.

Example

<html> 
    <head>  
      <link rel="stylesheet" type="text/css" href="style.css" />
    </head>  
    <body>
        <p>Welcome to CSS Tutorial</p>
    </body>  
</html>

Internal CSS

The stylesheet rules are located in a style element in the header of the document. They are called internal stylesheets.

Example

<html> 
    <head> 
        <style>
            p{
                color:#000;
            }
        </style>
    </head>  
    <body>
        <p>Welcome to CSS Tutorial</p>
    </body>  
</html>

 

Inline CSS

Inline CSS lets you apply a unique style to each HTML element. You assign CSS to a particular HTML element by using the style attribute with all CSS properties defined in it.

Example

<html> 
    <head>  
    </head>  
    <body>
        <p style="color:#000;">Welcome to CSS Tutorial</p>
    </body>  
</html>