Blog Detail

Home Blog Detail

What is CSS and its types?

Blog Img

CSS stands for Cascading Style Sheets.CSS is used to define styles for your web pages, including the design, layout and variations in display for different devices and screen sizes.

CSS saves a lot of work. It can control the layout of multiple web pages all at once. External stylesheets are stored in CSS files

The three types of CSS are:

  • Inline CSS
  • Internal CSS
  • External CSS
Inline CSS:
  • Inline CSS is written directly within the HTML element using the style attribute.
  • It’s used for applying styles to a specific element.
<h1 style="color: blue;">Welcome to Think4U</h1>
Internal CSS:
  • Internal CSS is written inside the <style> tag in the <head> section of the HTML document.
  • It affects the entire webpage or section of the webpage where it is written.
<html>
   <head>
      <style>
         body {
         background-color: #ddd;
         }
         h1 {
         color: green;
         }
      </style>
   </head>
   <body>
      <h1>Welcome to Think4U</h1>
   </body>
</html>
External CSS:
  • External CSS is written in a separate .css file and linked to the HTML document using the <link> tag.
  • This method is the most efficient for styling large websites as it keeps the HTML clean and allows you to reuse the same styles across multiple pages.
<html>
   <head>
      <link rel="stylesheet" type="text/css" href="styles.css">
   </head>
   <body>
      <h1>Welcome to Think4U</h1>
   </body>
</html>

style.css

body {
  font-family: Arial, sans-serif;
}
h1 {
  color: red;
}

© 2025Think4u. All Rights Reserved.