CSS stands for Cascading Style Sheets.
It is a stylesheet language used to describe the look and formatting of a webpage written in HTML.

While HTML defines the structure and content of a web page, CSS controls how that content appears — such as colors, fonts, layout, spacing, and overall design.

In short, HTML builds the skeleton, and CSS adds style and beauty to a website.

🧩 Purpose of CSS
  • To separate content (HTML) from presentation (design).
  • To make web pages attractive and consistent.
  • To enable responsive design (fit for all devices).
  • To allow developers to apply the same style to multiple pages easily.
⚙️ Basic Syntax of CSS
selector {
  property: value;
}

Example:

h1 {
  color: blue;
  font-size: 30px;
}

Explanation:

  • h1 → selector (the HTML element to style)
  • color and font-size → properties
  • blue and 30px → values

This code makes all <h1> headings blue and sets their font size to 30px.

🧱 Ways to Add CSS to HTML
  1. Inline CSS – written inside an HTML tag <h1 style="color:red;">Hello CSS</h1>
  2. Internal CSS – written inside the <style> tag in the HTML <head> section <style> p { color: green; } </style>
  3. External CSS – written in a separate .css file and linked using the <link> tag <link rel="stylesheet" href="style.css">
🌟 Key Features of CSS
  • Controls colors, fonts, spacing, and layout.
  • Supports animations and transitions.
  • Makes web pages responsive and mobile-friendly.
  • Reduces code repetition.
  • Easy to update and maintain design.

🧠 Types of CSS Selectors
  • Element Selectorp { color: blue; }
  • Class Selector.box { border: 1px solid black; }
  • ID Selector#header { background-color: gray; }
  • Group Selectorh1, h2, h3 { color: green; }
⚔️ Difference Between HTML and CSS
FeatureHTMLCSS
Full FormHyperText Markup LanguageCascading Style Sheets
PurposeStructure and contentStyling and presentation
Syntax TypeTag-basedRule-based
UsageCreates elementsStyles elements
SeparationContent onlyDesign only

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *