CSS Basics Guide
CSS Basics Guide
1. What is CSS?
CSS (Cascading Style Sheets) is used to style HTML documents by controlling layout, color, font,
and spacing.
2. CSS Syntax
Example:
selector {
property: value;
4. CSS Selectors
- Class Selector: Targets elements with a specific class attribute (e.g., .classname { color: blue; })
- ID Selector: Targets elements with a specific id attribute (e.g., #uniqueID { color: red; })
5. CSS Properties
Make your site look good on all devices. Use media queries and viewport settings.
body {
font-size: 14px;
7. Basic Example
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<h1>Welcome to My Page</h1>
<p>This is a paragraph.</p>
</body>
</html>
CSS (style.css):
body {
background-color: #f3f4f6;
color: #333;
h1 {
color: #1a73e8;
text-align: center;
p{
font-size: 16px;
line-height: 1.5;