CSS Introduction

CSS stands forCascading Style Sheets. CSS is the language that tells your browser how to render your web page - colors, fonts, spacing, layout, animation, etc.

Think in terms of building a house. HTML builds the structure and roof. CSS paints the structure, places the furniture, and hangs the curtains.

The Importance of CSS in Web Design

If CSS wasn't in use, the web could just be black text and white background.

The History of CSS - A Brief Overview

CSS was introduced in 1996. Prior to that, styling had to be done within the HTML.

With CSS, developers gained the ability to:

Understanding the Word “Cascading” in CSS

The word “Cascading” refers to how conflicting styles are resolved.

The priority depends on:

How Does CSS Work?

When a browser opens a webpage:

  1. It reads the HTML to build the structure.
  2. It reads the HTML structure first and then it reads the CSS and knows how to present the layout.

Example:


     <p>Hello, world!</p>
     


     p {
       color: blue;
       font-size: 20px;
     }
     

Types of CSS: Inline, Internal, and External

Important Features of CSS Everyone Should Know

CSS In Real Life - A simple analogy

Think of CSS like decorating a room. HTML is the structure of the room. CSS is everything that makes a room be nice to look at and be comfortable.

Common CSS Properties You Must Know

Property Purpose
color Text color
background-color Background color
font-size Size of the text
font-family Font type
margin Space outside an element
padding Space inside an element
border Line around the element
width & height Size of the element
display Layout behavior
position Placement on the page
text-align Align text

What Is Responsive Design In CSS?

Responsive design is the ability of a website to change layout in different size screens.

Example media query:


     @media (max-width: 600px) {
       body {
         background-color: lightblue;
       }
     }
     

CSS Selectors: Choosing What to Style

Tools and References to Learn CSS Better

Quick CSS Tips for New Learners

Conclusion: CSS is the Art of the Web

Learning CSS is like painting with code. Over time, as you start learning CSS you will paint beautiful masterpieces on the web.

HTML is the heart. CSS is the soul.

Try it Yourself