CSS

  • Last Updated : 30 Mar, 2022

CSS (Cascading Style Sheets) is a stylesheet language used to design the webpage to make it attractive. The reason for using this is to simplify the process of making web pages presentable. It allows you to apply styles to web pages. More importantly, it enables you to do this independent of the HTML that makes up each web page.

Related Courses:

CSS is a style sheet language that makes a website aesthetically appealing, Get ready to enhance your CSS skills with the all-new GeeksforGeeks CSS Course and learn concepts like box model, positioning schemes, inheritance, solving selector conflicts, etc. Join today!

CSS Tutorials

There are three types of CSS which are given below:

  • Inline
  • Internal or Embedded
  • External

Basic Format: It is the basic structure of HTML webpage and we use CSS style inside webpage. In a web page, we use internal CSS (i.e. adding CSS code inside <head> tag of HTML code).

<!DOCTYPE html>
<html>
 
<head>
    <!-- Head section of web page -->
    <title></title>
 
    <!-- Stylesheet of web page --> 
    <style></style>
</head>
 
<body>
    <!-- Body section of web page -->
</body>
 
</html>

Example: Let’s see a small example of HTML webpage with CSS styles. Here, we use styles to set the alignment and text color of a webpage.

<!DOCTYPE html>
<html>

<head>
    <title>
        Simple webpage
    </title>

    <!-- Stylesheet of web page -->
    <style>
        body {
            text-align: center;
        }

        h1 {
            color: green;
        }
    </style>
</head>

<body>
    <h1>Welcome to GeeksforGeeks</h1>

    <p>A computer science portal for geeks</p>
</body>

</html>

Output:

Why we learn CSS?

Styling is the essential property for any website. It increases the standards and overall look of the website that makes it easier for the user to interact with it. A website can be made without CSS, as styling is MUST since no user would want to interact with a dull and shabby website. So for knowing Web Development, learning CSS is mandatory.

  • Base for web development: HTML and CSS is the basic skill that every web developer should know. It is the basic skill that is required for building a website.
  • Makes your website look attractive: A website that’s dull and plain will not attract the user most probably, so adding some style would surely make your website presentable to the user.
  • Makes the design come live: A web developer is responsible for making the design given to him as a live product. It is used for styling to develop the design of the website.
  • Increases user experience of the website: A website with a simple yet beautiful UI would help the users to go through the website easily. It is used to make the user interface better.
  • More career opportunities: Since CSS is a basic requirement while learning Web Development, therefor there are abundant career opportunities for it. As a freelancer, you can land up to many projects.

Complete References:

Learn more about CSS:

Examples: Please go through this link to see the wide collection of programming examples. The examples are categorized based on the topics including properties, selectors, functions, and many more.

Recent Articles

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

My Personal Notes arrow_drop_up


Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.