Welcome to this easy CSS tutorial for beginners! In this guide, you will learn the basics of Cascading Style Sheets (CSS). Which is important for making websites look good. Whether you are new to CSS or want to improve your skills, this tutorial will teach you everything from simple rules and styling to more advanced topics like Flexbox and Grid layouts. By the end of this CSS tutorial, you will know how to create nice, responsive web designs that work well for users.

What is CSS?

CSS, or Cascading Style Sheets, is a language used to style and layout web pages made with HTML or XML. It helps web developers change how a website looks by adjusting things like fonts, colours, spacing, and where elements are placed. CSS keeps the content and design separate. Which is making it easier to update and maintain websites since changes can be made in one place and will show up everywhere. With tools like selectors and media queries, CSS helps create responsive designs that look good on different devices. It also allows for fun effects like animations and transitions, making websites more interactive. Overall, CSS is a key part of building attractive and functional websites. So this CSS tutorial will give all the necessary information as well as help you in learning CSS deeply.

Importance of CSS

Cascading Style Sheets is very important for web design because it controls how a webpage looks. Here’s why CSS is useful as well as why it is necessary to learn CSS coding:

  • Better Design: CSS helps make web pages colourful, stylish, and attractive.
  • Improves Readability: It makes text and layout easy to read and navigate.
  • Fits All Screens: It allows websites to adjust to different devices like phones, tablets, and computers.
  • Faster Loading: Webpages load quicker because CSS keeps design separate from content.
  • Easy to Update: One CSS file can change the design of many pages at once.
  • Looks Good on All Browsers: CSS ensures websites look the same on different web browsers.

How CSS Works with HTML?

In this CSS tutorial, here we will see how it works. So, CSS works with HTML to control the look and layout of web pages. Here is the explanation of how it works:

1. HTML Provides Structure

  • HTML creates the basic content of a webpage using elements like headings (<h1>), paragraphs (<p>), images (<img>), and buttons (<button>).

2. CSS Adds Style

  • CSS styles these elements by changing colours, fonts, sizes, spacing, and positioning.

3. Ways to Apply CSS in HTML

Here in this CSS tutorial, we will see the ways to apply CSS. So, they can be added to HTML in three ways:

  • Inline CSS – Written inside an HTML tag using the style attribute.

<p style="color: blue;">This is a blue paragraph.</p>


  • Internal CSS – Written inside the <style> tag in the HTML <head>.

<style>

  p { color: blue; }

</style>


  • External CSS – Written in a separate .css file and linked to HTML using <link>.

<link rel="stylesheet" href="styles.css">


4. CSS Selectors Target HTML Elements

CSS uses selectors to choose which HTML elements to style.

p { color: red; }  /* This will make all <p> text red */


CSS Fundamentals

CSS consists of three main components:

  • Selectors: These are patterns used to select the elements you want to style. Common selectors include element selectors (e.g., h1), class selectors (e.g., .classname), and ID selectors (e.g., #idname).
  • Properties: These define the aspects of the selected elements that you want to change. For example, color, font-size, and margin are all properties.
  • Values: These are the settings you apply to the properties. For instance, if you want to set the text colour to red, you would use the value red.

As you all know about the fundamentals now, it is time to see the syntax of CSS in this CSS tutorial:

CSS Syntax

The basic syntax of CSS is as follows:

selector {

    property: value;

}


For example:

h1 {

    color: red;

}


Basic CSS Styling

CSS is used to make web pages look better by adding colours, fonts, spacing, and layout styles. Here are the basics of CSS styling in this CSS tutorial:

1. Text Styling

CSS allows you to style text in various ways. Here are some common properties:

  • Font Family: Change the font of your text.

p {

    font-family: Arial, sans-serif;

}


  • Font Size: Adjust the size of your text.

p {

    font-size : 16px;

}


  • Font Weight: Make your text bold or light.

p {

    font-weight: bold;

}


2. Color and Background

A. Text Color

Here in this CSS tutorial, we will see how you can change the colour of the text using the color property.

p {

  color: red; /* Named color */

}


h1 {

  color: #3498db; /* Hex color */

}


span {

  color: rgb(255, 165, 0); /* RGB color */

}


h2 {

  color: rgba(0, 0, 0, 0.5); /* Transparent black */

}


B. Background Color

Use the background-color property to set the background.

body {

  background-color: lightgray;

}


div {

  background-color: #ffcc00;

}


C. Background Image

You can add an image as the background.

body {

  background-image: url('background.jpg'); /* Adds an image */

  background-size: cover; /* Covers the whole screen */

  background-repeat: no-repeat; /* Prevents repetition */

}


D. Background Size

By using the code of this CSS tutorial, you can adjust the sizes of the background images.

div {

  background-size: contain; /* Fits inside element */

}


section {

  background-size: cover; /* Covers entire element */

}


E. Background Position

You can position the background image.

div {

  background-position: center; /* Centers the image */

}


header {

  background-position: top left;

}


F. Background Attachment (Fixed or Scroll)

You can control whether the background moves when scrolling.

body {

  background-attachment: fixed; /* Stays fixed while scrolling */

}


div {

  background-attachment: scroll; /* Moves with scrolling */

}


G. Gradient Backgrounds

Now in this CSS tutorial, we will look at how CSS allows linear and radial gradients.

Linear Gradient (Top to Bottom)

div {

  background: linear-gradient(to bottom, red, yellow);

}


Radial Gradient (Center Outward)

section {

  background: radial-gradient(circle, blue, pink);

}


Summary:

Text Colors → color: red;, color: #ff0000;, color: rgb(255,0,0);
Background Colors → background-color: yellow;
Background Images → background-image: url('image.jpg');
Background Size & Position → background-size: cover;, background-position: center;
Gradients → background: linear-gradient(to right, blue, green);

As you have learned how to give the gradient using CSS, now in this CSS tutorial we will understand the box model.

3. Box Model

The CSS Box Model explains how elements are structured on a webpage. It consists of four parts:

📌 Content → The actual text or image inside the element.
📌 Padding → Space inside the border, around the content.
📌 Border → A line around the padding and content.
📌 Margin → Space outside the border, separating elements.

A. Box Model Structure

Here’s how it looks visually:

B. Box Model in Action

.box {

  width: 200px; /* Content width */

  height: 100px; /* Content height */

  

  padding: 20px; /* Space inside */

  border: 5px solid black; /* Border around */

  margin: 30px; /* Space outside */

  

  background-color: lightblue; /* Background color */

}


C. Understanding Box Model Properties

Padding → Increases space inside the border.

div {

  padding: 10px; /* Adds space inside the border */

}


You can also set different padding values for each side here in this CSS tutorial we will learn how to do so:

div {

  padding: 10px 20px 15px 5px; /* top right bottom left */

}


Border → Adds a visible frame around an element.

div {

  border: 2px solid red; /* Solid border */

  border-radius: 10px; /* Rounded corners */

}


Margin → Creates space around the element (outside the border).

div {

  margin: 20px; /* Adds space around */

}


As you can set paddings from each side, you can also set different margins for each side. Here in this CSS tutorial, we will explain how:

div {

  margin: 10px 15px 5px 0; /* top right bottom left */

}


D. Box Sizing: Content vs. Border Box

By default, the width and height apply only to the content.

.box {

  width: 200px;

  padding: 20px;

  border: 5px solid black;

}


🔹 Actual width = 200px (content) + 20px (left padding) + 20px (right padding) + 5px (left border) + 5px (right border) = 250px

✅ To include padding and border in the total size, use:

.box {

  box-sizing: border-box;

}


Now, the total width stays 200px (padding and border included).

E. Example: Box Model in Action

<!DOCTYPE html>

<html>

<head>

  <style>

    .box {

      width: 200px;

      height: 100px;

      padding: 20px;

      margin: 30px;

      border: 5px solid black;

      background-color: lightblue;

      box-sizing: border-box; /* Ensures total width stays 200px */

    }

  </style>

</head>

<body>


  <div class="box">This is a CSS tutorial</div>


</body>

</html>


Summary:

Content – The actual element (text, image, etc.).
Padding – Space inside the border.
Border – The outline around the padding and content.
Margin – Space outside the border to separate elements.
box-sizing: border-box – Includes padding and border in the total size.

CSS Layout Techniques

CSS provides different techniques to arrange elements on a webpage effectively. Here are the most important ones in this CSS tutorial:

1. Normal Flow (Default Layout)

By default, elements are arranged from top to bottom (block elements) and left to right (inline elements).

p {

  display: block; /* Each paragraph starts on a new line */

}


span {

  display: inline; /* Elements appear in the same line */

}


2. Display Property

The display property controls how elements behave.

Block Elements → Take full width

div {

  display: block; /* Starts on a new line */

}


Inline Elements → Stay in the same line

span {

  display: inline; /* Stays in line */

}


Inline-Block → Inline but keeps block properties

img {

  display: inline-block;

}


None → Hides the element

p {

  display: none;

}


3. Positioning Elements

The position property allows you to control where elements appear. Here in this CSS tutorial, we will see how it works:

Static (Default Positioning)

div {

  position: static; /* Follows normal flow */

}


Relative (Positioned from its normal place)

div {

  position: relative;

  top: 20px;  /* Moves 20px down */

  left: 10px; /* Moves 10px right */

}


Absolute (Positioned from the nearest positioned ancestor or <html> if none)

div {

  position: absolute;

  top: 50px;

  right: 20px;

}


Fixed (Stays in place even when scrolling)

header {

  position: fixed;

  top: 0;

  width: 100%;

  background-color: black;

}


Sticky (Acts like relative but becomes fixed when scrolling)

nav {

  position: sticky;

  top: 0;

  background-color: yellow;

}


4. CSS Flexbox (Best for One-Dimensional Layouts)

Flexbox is one of the most important topics to learn. Because it plays a vital role in responsive design. Flexbox helps align elements horizontally or vertically. So here in this CSS tutorial, we will see how it works:

Basic Flexbox Example

.container {

  display: flex;

  justify-content: space-between; /* Distributes items evenly */

  align-items: center; /* Aligns items vertically */

}

 

<div class="container">

  <div>Item 1</div>

  <div>Item 2</div>

  <div>Item 3</div>

</div>


Key Flexbox Properties
Property Description

display: flex;

Enables flexbox

justify-content

Aligns items horizontally (center, space-between, space-around)

align-items

Aligns items vertically (center, flex-start, flex-end)

flex-direction

Defines row or column layout (row, column)


5. CSS Grid (Best for Two-Dimensional Layouts)

As we have learned about Flexbox in the above section of this CSS tutorial. Now we will look at how CSS Grid is ideal for creating full-page layouts.

Basic Grid Example

.container {

  display: grid;

  grid-template-columns: repeat(3, 1fr); /* 3 equal columns */

  grid-gap: 10px; /* Space between grid items */

}

 

<div class="container">

  <div>Box 1</div>

  <div>Box 2</div>

  <div>Box 3</div>

</div>


Key Grid Properties
Property Description

display: grid;

Enables grid layout

grid-template-columns

Defines column structure (1fr, auto, px)

grid-template-rows

Defines row structure

grid-gap

Adds spacing between grid items

grid-area

Assign an area name to an element


6. Float Layout (Old Method, Not Recommended)

Floats were used before Flexbox and Grid but can still be useful.

img {

  float: left; /* Moves the image to the left */

  margin-right: 10px;

}


To clear floating elements consider this CSS example:

.clearfix::after {

  content: "";

  display: block;

  clear: both;

}


7. Responsive Design (Media Queries)

To make layouts responsive on different screen sizes, use media queries.

@media (max-width: 600px) {

  .container {

    flex-direction: column; /* Stack items vertically on small screens */

  }

}


Summary of Layout Techniques

Layout Method Best Use Case

Normal Flow

Default layout (top to bottom, left to right)

Positioning

Precise element placement (absolute, fixed, relative)

Flexbox

Aligning items in one direction (row/column)

Grid

Complex two-dimensional layouts

Float

Wrapping text around images (older method)

Media Queries

Making layouts responsive


Responsive Design in CSS

Responsive design ensures that a website looks good on all devices (desktops, tablets, and mobiles). It allows web pages to adjust based on the screen size. So here in this CSS tutorial, we will see how to make a responsive design:

1. Viewport Meta Tag (Important for Mobile Scaling)

To make a webpage responsive, add this to the <head> section of your HTML:

<meta name="viewport" content="width=device-width, initial-scale=1.0">


Why?

  • Ensures content fits the screen size.
  • Prevents mobile browsers from zooming out automatically.

2. CSS Media Queries (Key to Responsive Design)

Media queries apply different styles based on screen size.

Basic Media Query Example

body {

  background-color: lightblue;

}


/* When screen width is 600px or less */

@media (max-width: 600px) {

  body {

    background-color: lightgreen;

  }

}


Result:

  • Desktop → lightblue background.
  • Mobile (width ≤ 600px) → lightgreen background.

3. Responsive Layout with Media Queries

Example of a 2-column layout on desktop, changing to a single-column layout on mobile:

.container {

  display: flex;

  flex-wrap: wrap;

}


.box {

  width: 50%; /* 2 columns on desktop */

  padding: 20px;

  background-color: lightcoral;

  text-align: center;

}


/* For screens 600px or smaller, switch to single column */

@media (max-width: 600px) {

  .box {

    width: 100%;

  }

}


Result:

  • Desktop → 2 columns.
  • Mobile → 1 column.

<div class="container">

  <div class="box">HTML Tutorial</div>

  <div class="box">CSS Tutorial</div>  

</div>


4. Flexbox for Responsive Design

Flexbox makes responsive layouts easy.

.container {

  display: flex;

  flex-wrap: wrap;

  justify-content: space-around;

}


.box {

  width: 300px;

  padding: 20px;

  background-color: skyblue;

  margin: 10px;

  text-align: center;

}


Flex-wrap allows items to move to the next row if they don’t fit.

5. CSS Grid for Responsive Design

CSS Grid is great for complex layouts.

.container {

  display: grid;

  grid-template-columns: repeat(3, 1fr);

  gap: 10px;

}


/* Change to 1 column on smaller screens */

@media (max-width: 768px) {

  .container {

    grid-template-columns: repeat(1, 1fr);

  }

}


Desktop → 3 columns.
Tablet/Mobile → 1 column.

<div class="container">

  <div class="box">Box 1</div>

  <div class="box">Box 2</div>

  <div class="box">Box 3</div>

</div>


6. Responsive Images (Make Images Adjust to Screen)

Use max-width: 100% to make images scale without overflow.

img {

  max-width: 100%;

  height: auto;

}


Image shrinks on smaller screens.

7. Responsive Text (Using em or rem)

Avoid px for font sizes; use relative units:

body {

  font-size: 16px; /* Default */

}


h1 {

  font-size: 2rem; /* Scales based on root font size */

}


8. Mobile-Friendly Navigation (Hamburger Menu)

On small screens, show a menu icon instead of a full navbar.

.nav {

  display: flex;

  justify-content: space-between;

  padding: 10px;

}


.menu {

  display: none; /* Hide menu on big screens */

}


@media (max-width: 600px) {

  .menu {

    display: block; /* Show on mobile */

  }

}



<div class="nav">

  <span>Logo</span>

  <span class="menu">☰</span> <!-- Hamburger icon -->

</div>


9. Using min-width vs. max-width in Media Queries

Media Query Type When to Use

max-width: 600px

Styles apply below 600px (for mobile-first design).

min-width: 600px

Styles apply above 600px (for desktop-first design).


10. Full Responsive Example

<!DOCTYPE html>

<html lang="en">

<head>

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>CSS tutorial</title>

  <style>

    body {

      font-family: Arial, sans-serif;

      margin: 0;

      padding: 0;

    }


    .container {

      display: flex;

      flex-wrap: wrap;

      justify-content: space-around;

      padding: 20px;

    }


    .box {

      width: 300px;

      padding: 20px;

      background-color: orange;

      text-align: center;

      margin: 10px;

    }


    /* Responsive styles */

    @media (max-width: 600px) {

      .box {

        width: 100%;

      }

    }

  </style>

</head>

<body>


  <div class="container">

    <div class="box">Box 1</div>

    <div class="box">Box 2</div>

    <div class="box">Box 3</div>

  </div>


</body>

</html>


Desktop → 3 columns


Mobile → 1 column

Summary: How to Make a Website Responsive

Use the <meta viewport> tag to make pages adjust to devices.
Use media queries (@media) to apply different styles at different screen sizes.
Use flexbox/grid for flexible layouts.
Use max-width: 100% for images to prevent overflow.
Use relative units (em, rem, %) instead of fixed px.
Hide/show elements for better mobile UX (like hamburger menus).

Advanced CSS Techniques

Once you understand the basics of CSS, you can learn an advanced CSS tutorial that will take your styling to the next level using advanced CSS. These techniques improve performance, maintainability, and interactivity.

A. CSS Variables (Custom Properties)

CSS variables let you store values (like colours, fonts, and sizes) for reuse across stylesheets.

Example:

:root {

  --primary-color: #3498db;

  --secondary-color: #2ecc71;

  --font-size: 16px;

}


body {

  background-color: var(--primary-color);

  color: white;

  font-size: var(--font-size);

}


button {

  background-color: var(--secondary-color);

  color: white;

  padding: 10px 20px;

}


Benefits:

  • Easier to update styles globally.
  • Improves code readability.
  • Allows dynamic theming.

B. CSS Grid (Best for Two-Dimensional Layouts)

We are reading about advanced CSS in this part of the CSS tutorial. So it is also important to study CSS Grid because it makes complex layouts easy.

Example: Responsive 3-Column Grid

.container {

  display: grid;

  grid-template-columns: repeat(3, 1fr);

  gap: 10px;

}


@media (max-width: 600px) {

  .container {

    grid-template-columns: repeat(1, 1fr);

  }

}


Benefits:

  • More powerful than Flexbox for layouts.
  • Creates clean, flexible structures.

C. Advanced Flexbox Techniques

Here in this CSS tutorial, we will see an advanced flexbox. As we have discussed above, it is great for one-dimensional layouts.

Example: Auto-Sizing Columns

.container {

  display: flex;

  flex-wrap: wrap;

}


.box {

  flex: 1; /* Takes equal space */

  min-width: 200px; /* Prevents shrinking too much */

  padding: 20px;

  background-color: coral;

}


Benefits:

  • Perfect for dynamic, responsive elements.

D. CSS Transitions (Smooth Effects)

Use transition to animate color, size, opacity, and position.

Example: Button Hover Effect

button {

  background-color: #3498db;

  color: white;

  padding: 10px 20px;

  transition: background-color 0.3s ease-in-out;

}


button:hover {

  background-color: #2ecc71;

}


Smooth animations without JavaScript.

E. CSS Animations (Keyframes)

@keyframes allows complex animations.

Example: Fade-In Animation

@keyframes fadeIn {

  0% {

    opacity: 0;

  }

  100% {

    opacity: 1;

  }

}


.box {

  animation: fadeIn 2s ease-in-out;

}


Animations can be looped, reversed, or timed.

F. CSS Transform (Rotate, Scale, Skew)

Transforms allow rotating, scaling, and moving elements.

Example: Rotating an Image

img {

  transform: rotate(15deg);

}


Example: Scaling an Element

.box:hover {

  transform: scale(1.2); /* Increases size on hover */

}

 

Great for UI interactions and effects.

G. CSS Clipping & Masking (Custom Shapes)

Create unique shapes using clip-path and mask.

Example: Clipping a Div into a Circle

.box {

  width: 100px;

  height: 100px;

  background-color: red;

  clip-path: circle(50%);

}


Example: Masking an Image

img {

  mask-image: linear-gradient(to bottom, rgba(0,0,0,1), rgba(0,0,0,0));

}


Great for custom UI shapes and effects.

H. CSS Scroll Snap (Better Scrolling Experience)

Here in this CSS tutorial, we will look at how scroll-snap-type works. So it locks scrolling to defined positions.

Example: Horizontal Scroll Snap

.container {

  display: flex;

  overflow-x: auto;

  scroll-snap-type: x mandatory;

}


.item {

  width: 300px;

  scroll-snap-align: center;

}


Enhances user experience in carousels and sliders.

I. CSS Blend Modes & Filters (Photo Effects)

You can apply color blending and filters without Photoshop!

Example: Grayscale Filter

img {

  filter: grayscale(100%);

}


Example: Text with Background Image Blend Mode

.text {

  background: url('image.jpg');

  mix-blend-mode: multiply;

}


Gives modern effects without extra images.

J. CSS Scroll Animations (Parallax & Sticky)

Example: Sticky Navigation

.navbar {

  position: sticky;

  top: 0;

  background: white;

}


Navbar sticks when scrolling.

K. Dark Mode with CSS

Here in this  CSS tutorial, we will see how we can create a dark mode theme using prefers-color-scheme.

Example: Dark Mode Detection

@media (prefers-color-scheme: dark) {

  body {

    background-color: black;

    color: white;

  }

}


Automatically applies dark mode if the user prefers it.

L. Advanced Responsive Techniques

Use clamp() for flexible text sizes.

Example: Responsive Font Size

h1 {

  font-size: clamp(1.5rem, 5vw, 3rem);

}


Adapts text size based on screen width.

M. Glassmorphism (Blurred UI Effect)

A trendy UI effect with blurred backgrounds.

Example: Glass Effect

.glass {

  background: rgba(255, 255, 255, 0.2);

  backdrop-filter: blur(10px);

}


Great for modern UI elements.

N. CSS Grid Masonry Layout

CSS Grid allows Pinterest-style masonry layouts.

Example: Masonry Grid

.container {

  display: grid;

  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));

  gap: 10px;

}


No JavaScript required!

O. CSS Subgrid (For Nested Layouts)

subgrid lets child elements inherit grid properties.

Example: Using Subgrid

.parent {

  display: grid;

  grid-template-columns: 1fr 1fr;

}


.child {

  display: grid;

  grid-template-columns: subgrid;

}


Allows better control of nested layouts.

Summary: Why Use Advanced CSS Techniques?
Feature Benefit

CSS Variables

Reusable styles, better maintainability

CSS Grid

Complex layouts make it easy

Flexbox

Responsive one-dimensional layouts

Animations & Transitions

Smooth UI interactions

Dark Mode Support

Automatic dark theme

Scroll Snap

Improved user scrolling experience

Glassmorphism

Modern UI effect

CSS Grid Masonry

Pinterest-like layouts


CSS Frameworks

Now in this CSS tutorial, it is the time to learn about the frameworks of the CSS. So, they help developers quickly build modern, responsive, and consistent websites without writing CSS from scratch. They provide predefined styles, layouts, and components that speed up development.

1. Why use a CSS framework?

  • Saves time ⏳ (No need to write CSS from scratch).
  • Ensures consistency 🎨 (Predefined styles maintain a uniform look).
  • Provides responsive design 📱 (Built-in support for different screen sizes).
  • Includes UI components 🧩 (Buttons, grids, navbars, modals, etc.).

2. Popular Frameworks

Here are some of the most commonly used frameworks:

Framework Best For Key Features

Bootstrap

General UI development

Grid system, components, JavaScript plugins

Tailwind CSS

Utility-first styling

Customizable, lightweight, no pre-styled components

Bulma

Simple and modern UI

Flexbox-based, easy to learn

Foundation

Complex and scalable projects

Responsive grid, accessibility-focused

Materialize

Google Material Design

Prebuilt Material Design components

UIKit

Minimalist and lightweight

Modular, easy to integrate


3. Bootstrap (Most Popular)

A. What is Bootstrap?

Bootstrap is the most widely used CSS framework, providing a grid system, responsive design, and pre-built UI components.

B. How to Use Bootstrap
a. Include Bootstrap via CDN:

Add this inside your HTML <head>:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">


b. Example: Responsive Grid Layout

<div class="container">

  <div class="row">

    <div class="col-md-6">HTML Tutorial</div>

    <div class="col-md-6">CSS tutorial</div>

  </div>

</div>


Features of Bootstrap:
  • Grid System (row, col-md-6) for layouts.
  • Prebuilt Components (buttons, cards, alerts).
  • Responsive Design (Works on all screen sizes).

4. Tailwind CSS (Utility-First Framework)

A.  What is Tailwind CSS?

If you want to learn CSS using the Tailwind framework, you need to know that it is a utility-first CSS framework where you style elements directly in HTML using classes.

B. How to Use Tailwind CSS
Include Tailwind via CDN:

<script src="https://cdn.tailwindcss.com"></script>


Example: Responsive Button

<button class="bg-blue-500 text-white px-4 py-2 rounded-md hover:bg-blue-700">

  Click Me

</button>


Features of Tailwind CSS:
  • No predefined components (you style everything yourself).
  • More flexibility (customizable without writing custom CSS).
  • Mobile-first responsive design (md:, lg:, etc.).

5. Bulma (Simple & Modern)

Bulma is a lightweight, modern CSS framework that is flexbox-based and easy to learn.

A. How to Use Bulma
Include Bulma via CDN:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma/css/bulma.min.css">


Example: Simple Card

<div class="card">

  <div class="card-content">

    <p class="title">CSS tutorial</p>

    <p class="subtitle">A simple responsive card</p>

  </div>

</div>


Features of Bulma:
  • Flexbox-based layout.
  • Clean, modern design.
  • Lightweight and easy to use.

6. Foundation (Advanced & Scalable)

The foundation is a powerful framework for complex web applications with advanced grid and accessibility features.

A. How to Use Foundation
Include Foundation via CDN:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/foundation-sites/dist/css/foundation.min.css">


Example: Responsive Grid

<div class="grid-container">

  <div class="grid-x grid-padding-x">

    <div class="cell medium-6">CSS tutorial</div>

    <div class="cell medium-6">JavaScript Tutorial</div>

  </div>

</div>


Features of the Foundation:
  • Advanced responsive grid system.
  • Highly accessible (ADA-compliant).
  • Great for large-scale projects.

7. Materialize (Material Design)

Materialize is based on Google’s Material Design principles, offering beautiful pre-styled components.

How to Use Materialize?
Include Materialize via CDN:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">


Example: Floating Button

<a class="btn-floating btn-large red">

  <i class="material-icons">add</i>

</a>


Features of Materialize:
  • Material Design components (buttons, cards, modals).
  • Mobile-first and responsive.

8. UIKit (Minimal & Modular)

UIKit is a minimalist and lightweight framework with a modular structure.

A. How to Use UIKit
Include UIKit via CDN:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/uikit@3.16.24/dist/css/uikit.min.css">


Example: Navigation Bar

<nav class="uk-navbar-container" uk-navbar>

  <div class="uk-navbar-left">

    <a class="uk-navbar-item uk-logo" href="#">CSS tutorial</a>

  </div>

</nav>


Features of UIKit:
  • Small file size.
  • Modular approach (use only what you need).

9. Which CSS Framework Should You Choose?

If you need... Use this Framework

The most popular and widely used framework

Bootstrap

Full control over styling, utility-based

Tailwind CSS

Simple, clean, and flexbox-based

Bulma

Scalable and complex designs

Foundation

Material Design look and feel

Materialize

Minimal, lightweight styling

UIKit


Summary
  • CSS frameworks save time and ensure consistent designs.
  • Bootstrap is best for general UI development.
  • Tailwind CSS offers more flexibility with utility-first classes.
  • Bulma, Foundation, Materialize, and UIKit offer unique advantages.

Best Practices in CSS

Using best practices in CSS is important for making stylesheets that are easy to manage and work well. First, choose a clear naming system, like BEM (Block Element Modifier), so class names are easily understood. Organize your CSS by putting similar styles together and adding comments to explain tricky parts. Try to avoid using inline styles and instead use external stylesheets, which makes it easier to reuse styles. Keep your CSS DRY (Don't Repeat Yourself) by not repeating code and using classes and variables. Improve performance by reducing the size of CSS files and combining them to lower the number of requests. Lastly, make sure your website is accessible by using good colour contrast and clear focus styles for clickable elements, which helps all users.

Conclusion

In conclusion, learning CSS is important for anyone who wants to make good-looking and functional websites. This CSS tutorial has taught you the basics, like CSS syntax and the box model, as well as advanced techniques like Flexbox, Grid, and responsive design. By following best practices and using CSS frameworks, developers can work more efficiently and keep their designs consistent. As you keep learning about web development. Remember that CSS not only makes your sites look better but also helps users have a better experience. Keep trying new things and practising to fully use CSS in your web designs.