CSS Tutorials

  • Last Updated : 19 Mar, 2021



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

There are three types of CSS which are given below:

  • Inline CSS
  • Internal or Embedded CSS
  • External CSS

Why we learn CSS?
Styling has been an essential property for any website since many decades. It increases the standards and overall look of the website which makes it easier for the user to interact with it. A website cannot 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 must.

  • 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 in making the design given to him as a live product. CSS is used for styling to develop the design of the website.
  • Increases user experience of website: A website with a simple yet beautiful UI would help the users to go through the website easily. CSS 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 too you can land up to many projects.

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 CSS styles to set the alignment and text color in a webpage.

<!DOCTYPE html>
<html>

<head>
    <title>
        Simple HTML webpage with CSS style
    </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:

Learn more about HTML:

CSS Complete References:

Recent Articles on CSS

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.