CSS Introduction
CSSCSS (Cascading Style Sheets) controls how HTML elements look — colors, fonts, spacing, layout.
HTML = structure. CSS = design. Together they create beautiful web pages.
3 Ways to Add CSS
- Inline — style attribute on element
- Internal — <style> tag in <head>
- External — separate .css file (recommended!)
Example — CSS
/* External CSS file: style.css */
h1 {
color: #4f46e5;
font-size: 2rem;
text-align: center;
}
p {
color: #64748b;
font-size: 1.1rem;
line-height: 1.6;
}
Result
Styled Heading
This paragraph is styled with CSS. Notice the color, size, and spacing.