What is CSS ?

Home / CSS / What is CSS ?

CSS (Cascading Style Sheets) is a style sheet language that is used to describe the visual style and layout of web pages. It provides a way to separate the presentation of a web page from its structure and content, allowing developers to create a consistent and visually appealing design for their websites.

CSS Code

 h1 {
     font-size: 24px;
     color: #333333;
     } 

In this rule, we start with the selector h1 , which matches all h1 elements in the web page. We then define two declarations: font-size sets the font size to 24 pixels, and color sets the text color to a dark gray ( #333333 in hex notation).

To use this rule in a web page, we would typically save the code in a separate file with the extension .css, and then include it in our HTML document using a  link element in the head section:

<!DOCTYPE html>
<html>
    <head>
         <link rel="stylesheet" type="text/css" href="style.css">
    </head>
    <body>
        <h1>Welcome to my website</h1>
        <p>This is a paragraph of text.</p>
    </body>
</html> 

In this HTML document, we include the css file style.css using a link element. This links rules defined in style.css to the HTML document, allowing the h1 elements to be displayed with the font size and color specified in the rule.

Recent Post