1.0 KiB
1.0 KiB
CSS Styling Basics
Introduction
CSS stands for Cascading Style Sheets.
It is used to style and layout web pages — for example, to change font sizes, colors, spacing, and the general look of HTML content.
What is CSS?
- CSS is a style sheet language used alongside HTML.
- It separates content (HTML) from presentation (CSS).
Why Use CSS?
- Makes webpages visually attractive.
- Helps control layout and design across many pages.
- Keeps HTML clean and focused only on structure.
CSS Syntax
A CSS rule has two parts:
- Selector: chooses the HTML element(s) to style
- Declaration block: contains style properties and values.
How CSS is Applied
CSS can be added in 3 ways: Inline – inside an HTML tag Internal – inside <style> in the HTML <head> External – as a separate .css file linked from the HTML
Basic Style Properties
color – text color background-color – background color font-size – size of text margin, padding – spacing control
Example: h1 { color: blue; font-size: 2em; }