๐จ CSS COURSE โ MODULE 1: INTRODUCTION
๐ File: intro.md
๐ง What is CSS?
๐ Introduction
CSS stands for Cascading Style Sheets.
It is used to style HTML elements and control how a webpage looks.
๐ HTML = structure ๐ CSS = design & appearance
๐ก Why CSS is Important
Without CSS:
- Websites look plain
- No colors
- No layout
- No design
With CSS:
- Beautiful UI
- Responsive design
- Modern websites
๐งฑ How CSS Works
CSS works by selecting HTML elements and applying styles:
p {
color: blue;
}
โ This makes all <p> text blue
๐ Ways to Add CSS
1. Inline CSS
<p style="color:red;">Hello</p>
2. Internal CSS
<style>
p {
color: red;
}
</style>
3. External CSS (BEST PRACTICE)
<link rel="stylesheet" href="style.css" />
p {
color: red;
}
๐ง Important Concept
๐ CSS follows a rule:
selector { property: value; }
Example:
h1 {
color: green;
font-size: 30px;
}
๐ฏ Real Example
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1>Welcome</h1>
<p>This is CSS styling</p>
</body>
</html>
h1 {
color: blue;
}
p {
color: gray;
}
๐ซ Common Mistakes
- Forgetting
;in CSS โ - Wrong selector โ
- Mixing HTML and CSS incorrectly โ
๐งช Mini Exercise
Create:
- An HTML page
- Add external CSS file
- Style:
- Heading โ red
- Paragraph โ gray
- Background โ light color