PAGE 1 – Introduction to CSS
CSS stands for Cascading Style Sheets.
It is used to style and design HTML web pages.
While HTML creates structure, CSS controls appearance.
PAGE 2 – How CSS Works
CSS selects HTML elements and applies styles to them.
p {
color: blue;
font-size: 18px;
}
This makes all paragraphs blue and 18px in size.
PAGE 3 – Ways to Add CSS
1. Inline CSS
<p style="color:red;">Hello</p>
2. Internal CSS
<style>
p { color: green; }
</style>
3. External CSS (Best Practice)
<link rel="stylesheet" href="[Link]">
PAGE 4 – Selectors
Selectors target HTML elements.
/* Element Selector */
p { color: blue; }
/* Class Selector */
.box { background: yellow; }
/* ID Selector */
#main { font-size: 20px; }
PAGE 5 – Colors and Backgrounds
body {
background-color: lightgray;
}
h1 {
color: darkblue;
}
Colors can be named, HEX, RGB, or HSL.
PAGE 6 – Box Model
Every HTML element is a box.
Box Model consists of:
Content → Padding → Border → Margin
div {
padding: 20px;
border: 2px solid black;
margin: 10px;
}
PAGE 7 – Fonts and Text Styling
p {
font-family: Arial;
font-size: 16px;
font-weight: bold;
text-align: center;
}
PAGE 8 – Flexbox (Layout)
Flexbox helps align items easily.
container {
display: flex;
justify-content: center;
align-items: center;
}
PAGE 9 – Responsive Design
Responsive design makes websites work on all devices.
@media (max-width: 600px) {
body {
background-color: lightblue;
}
}
PAGE 10 – Best Practices
✔ Use external CSS files.
✔ Keep code organized.
✔ Avoid inline styling.
✔ Use meaningful class names.
✔ Write clean and readable code.