Css
What is CSS?
CSS stands for Cascading Style Sheets.
It is used to style and design web pages.
If HTML is the structure (like walls of a house π ),
then CSS is the design (color, paint, decoration).
πΉ Why do we use CSS?
CSS is used to:
Add colors
Change fonts
Set backgrounds
Adjust spacing
Design layouts
Make websites look attractive ✨
πΉ Simple Example
HTML
Copy code
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
color: blue;
text-align: center;
}
</style>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
π In this example:
h1 text becomes blue
Text is center aligned
πΉ Types of CSS
Inline CSS
Inside the HTML tag
HTML
Copy code
<h1 style="color:red;">Hello</h1>
Internal CSS
Inside <style> tag in <head>
External CSS (Best method)
Separate .css file
HTML
Copy code
<link rel="stylesheet" href="style.css">
πΉ Basic CSS Syntax
CSS
Copy code
selector {
property: value;
}
Example:
CSS
Copy code
p {
color: green;
font-size: 20px;
}
p → selector
color → property
green → value
Comments
Post a Comment