ADVERTISEMENTS

What is CSS ?

CSS stands for Cascading Style Sheets, which is a style sheet language used for describing the presentation and styling of HTML or XML documents. It is a powerful and flexible tool that allows web developers to separate the content of a web page from its presentation and styling, making it easier to maintain and update the design of a website.

With CSS, you can control the layout, typography, colors, and other visual aspects of a web page. You can apply styles to individual elements or groups of elements using selectors, and you can define styles for various devices and screen sizes to create responsive designs that adapt to different viewing environments.

It is used in combination with HTML and JavaScript to create modern, interactive, and engaging web pages. It allows developers to create visually appealing and functional websites that are optimized for user experience. These are typically defined in a separate CSS file or within the HTML document using the <style> tag. The styles are then applied to HTML elements using selectors, which target specific elements on the page.

CSS has evolved over the years, and new features and capabilities have been added to the language. Today, CSS is a crucial part of modern web development, and it is essential for creating visually appealing, responsive, and user-friendly websites. These are defined in a separate file or within the HTML document using the <style> tag. The styles are then applied to the HTML elements using selectors, which target specific elements on the page.

ADVERTISEMENTS
/* This is a CSS comment */
h1 {
  color: blue;
  font-size: 24px;
}

In this example, we have created a style for the <h1> element that sets its color to blue and its font size to 24 pixels. The style is applied to the <h1> element using a selector that targets all <h1> elements on the page.

To use this CSS style on an HTML document, you can either include it within a <style> tag in the head section of the HTML document. You can save the CSS style in a separate file with a .css extension and include it in the HTML document using a <link> tag in the head section.


<!DOCTYPE html>
<html>
<head>
  <title>My Web Page</title>
  <link rel="stylesheet" type="text/css" href="style.css">
  <style>
    h1 {
      color: blue;
      font-size: 24px;
    }
  </style>
</head>
<body>
  <h1>Welcome to My Web Page</h1>
  <p>This is a paragraph of text.</p>
</body>
</html>

In this example, we have saved the CSS style in a file called style.css, which we have linked to the HTML document using a <link> tag. The href attribute specifies the location of the CSS file.

ADVERTISEMENTS