What is CSS?
- CSS stands for Cascading Style Sheets
- CSS is used to style and design web pages
- It controls colors, fonts, spacing, and layout
- CSS makes websites look attractive and user-friendly
- CSS works with HTML to improve page design
- It allows you to apply styles to multiple pages at once
What is CSS in Simple Words?
CSS (Cascading Style Sheets) is a language used to style web pages. HTML gives the structure of a webpage. We can change colors, fonts, space between elements, background, and layout to make a website more beautiful and easy to use.
Simple CSS Example
Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
Example Explained
h1
This targets all heading tags (<h1>) and applies styles to them.
color
Used to change the text color (example: blue, red, black).
font-size
Controls how big or small the text appears on the screen.
p
This targets all paragraph elements (<p>).
line-height
Controls space between lines for better readability.
Why CSS is Important?
💡 Simple Answer:
CSS is important because it makes websites look good and professional. Without CSS, websites look plain and unstyled.
How CSS Works with HTML
Working: HTML gives structure (like headings and paragraphs),
and CSS adds style (like colors, layout, and design). Both work together to create a complete web page.
Ways to Add CSS
Types
h1 {
color: blue;
font-size: 32px;
}
p {
color: gray;
line-height: 1.6;
}
Note: External CSS is mostly used in real websites because it keeps code clean and reusable.
Real Life Example
Think of HTML as a house structure (walls, roof, rooms). CSS is like paint, furniture, and decoration that makes the house beautiful.