CSS Tutorial

  • Last Updated : 07 Jun, 2023

This CSS tutorial, whether you’re a student or a professional, this tutorial is a valuable resource to enhance the visual appeal of your websites or personal blogs. It covers all the basic and advanced concepts of CSS, such as properties, selectors, functions, media queries and more. CSS is used to enhance the visual presentation of web pages. Without the use of CSS, a web page will appear visually unappealing.

Learn CSS today and elevate your web design skills with our comprehensive CSS tutorial.

CSS Tutorial

What is CSS?

CSS (Cascading Style Sheets) is used to styles web pages. Cascading Style Sheets are fondly referred to as CSS. The reason for using this is to simplify the process of making web pages presentable. It allows you to apply styles on web pages. More importantly, it enables you to do this independently of the HTML that makes up each web page.

Why learn CSS?

Styling is an 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.

CSS Code Format: It is the basic structure of the CSS style of a webpage.

 body {
     background-color: lightgray;
 h1 {
     color: green;
     text-align: center;
 p {
     font-family: sans-serif;
     font-size: 16px;

Types of CSS: There are three types of CSS which are given below.

  • Inline: Inline CSS contains the CSS property in the body section attached with the element known as inline CSS.
  • Internal or Embedded: The CSS ruleset should be within the HTML file in the head section i.e the CSS is embedded within the HTML file. 
  • External: External CSS contains a separate CSS file that contains only style property with the help of tag attributes.


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>

        Simple webpage

    <!-- Stylesheet of web page -->
        body {
            text-align: center;
        h1 {
            color: green;

    <h1>Welcome to GeeksforGeeks</h1>

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



CSS Tutorial Code Output

CSS Key Features:

  • CSS specifies how HTML elements should be displayed on screens.
  • The Major key feature of CSS includes styling rules which are interpreted by the client browser and applied to various elements.
  • Using CSS, you can control the color text, the style of fonts, spacing between elements, how columns are sized, variation in display for different devices and screen size as well as a variety of other effects.

CSS Interview Questions: 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.


Q. Is learning CSS worth it when there are lots of CSS Frameworks?

A. Yes, learning CSS is still worth to investment time, it gives you a free hand to design your website as you want. Frameworks is a collection of pre-written CSS code you can utilize as a starting point for your own projects.

Q. What does CSS mean?

A. CSS was established to address the issue of tags for formatting a web page, which were not intended in HTML. CSS eliminated the style formatting of HTML pages, making it easier and more cost-effective to create large websites.

Q. How CSS is different from HTML?

A. HTML is used to define a web page structure, while CSS is used to style it. CSS can be internal or external depending on the requirement, and has higher backup and support than HTML.

Recent Articles

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

My Personal Notes arrow_drop_up