Open In App

Uses of CSS

What is CSS?

CSS stands for Cascading Style Sheets and it is used for designing and responsiveness of web pages. It helps in maintaining the positioning of each and every element that should be displayed on the web page. It is highly used for creating interactive user interfaces.’

What are the uses of CSS?

1. Helps in Styling

2. Time efficient

3. Many more attributes

4. Helps in the maintenance of web pages

Applications of CSS

Practical Implementation of CSS

Examples: In this example, we are using the explained approach, in order to create the Responsive Webpage.






<!DOCTYPE html>
<html>
  
<head>
    <meta name="viewport" 
          content="width=device-width, 
                   initial-scale=1.0">
    <link rel="stylesheet" 
          href="./style.css">
</head>
  
<body>
    <div>
        <h2>GeekForGeeks</h2>
        <img src=
    </div>
</body>
  
</html>




/* style.css*/
body {
    background-color: wheat;
}
  
h2 {
    font-size: 60px;
}
  
@media only screen and (max-width: 1000px) {
    body {
        background-color: rgb(61, 239, 224);
    }
  
    h2 {
        font-size: 45px;
    }
  
    img {
        width: 350px;
        height: 350px;
    }
}
  
@media only screen and (max-width: 600px) {
    body {
        background-color: green;
    }
  
    h2 {
        font-size: 35px;
    }
  
    img {
        width: 250px;
        height: 250px;
    }
}

Output:

Responsiveness using CSS

Example: In this example, we are using the above-explained approach.






<!DOCTYPE html>
<html lang="en">
  
<head>
    <meta charset="UTF-8">
    <meta name="viewport" 
          content="width=device-width, 
                   initial-scale=1.0">
    <title>link behaviour</title>
    <link rel="stylesheet" 
          href="./style.css">
  
</head>
  
<body>
    <div>
  
        <a href="https://www.geeksforgeeks.org/" 
           target="_blank">
            GeekForGeeks
        </a>
        <p>
            A Computer Science portal for geeks. 
            It contains well written, well thought 
            and well explained computer
            science and programming articles
        </p>
  
    </div>
  
</body>
  
</html>




/* style.css*/
* {
    text-align: center;
    margin: auto;
    padding: 15px;
}
  
p {
    font-size: 24px;
    width: 800px;
    text-align: center;
}
  
a {
    color: green;
    font-size: 26px;
}
  
a:visited {
    color: purple;
}
  
a:hover {
    color: coral;
}
  
a:active {
    color: blue;
}

Output:

Links in CSS


Article Tags :