CSS Type

Type of css

Here are some common types of CSS:

  • Inline CSS:
  • Internal or Embedded CSS
  • External CSS

Inline CSS:

Description: Styles are applied directly within the HTML tags using the style attribute.

Example:

                          
                            <p style="color: blue; font-size: 16px;">This is a paragraph.</p>                                                             
                          
                        

Internal or Embedded CSS:

Description: Styles are defined within the HTML file using the <style> tag in the document's <head> section.

Example:

                          
                            <head>
                              <style>
                                h1 {
                                  color: green;
                                }
                              </style>
                            </head>
                            <body>
                              <h1>This is a heading</h1>
                            </body>
                                                                                         
                          
                        

External CSS:

Description: Styles are defined in a separate external CSS file and linked to the HTML document.

Example:

                          
                            <!-- In the HTML file -->
                            <link rel="stylesheet" type="text/css" href="styles.css">
                            
                            <!-- In the external CSS file (styles.css) -->
                            h1 {
                              color: blue;
                            }