Nearby lessons

2 of 19

🧩 CSS Syntax

📌 What is CSS Syntax?

CSS Syntax defines how to apply styling to HTML elements using selectors, properties, and values. Understanding the basic structure helps you write effective and clean CSS rules.

📖 CSS Overview

CSS (Cascading Style Sheets) provides styling to HTML elements. It is made up of rules that combine selectors with properties and values. Browsers use these rules to style content on webpages.

🔧 CSS Rule Components

  • 🎯 Selector: Specifies which HTML element to style (e.g., h1, .box, #main).
  • ⚙️ Property: The visual aspect to modify (e.g., color, font-size, margin).
  • 🎨 Value: The setting for the property (e.g., blue, 16px, #ffffff).

🧱 Basic Syntax Structure

selector { property: value; }

💡 Complete Example

Code Example
PREVIEW READY
Loading Editor...
Live Preview

🧠 Test Your Knowledge

3 Questions

Progress: 0 / 3
Keep Going!CSS - Types