CSS Introduction

CSS Tutorial

CSS Introduction

CSS (Cascading Style Sheets) is a styling language used to control how HTML elements look on a webpage.
It defines colors, layouts, spacing, fonts, sizes, animations, and overall design.

HTML = Structure
CSS = Style / Design


How CSS Works

You write CSS rules that target HTML elements and apply styles to them.

A CSS rule has two parts:

  1. Selector → Which element to style

  2. Declaration → Style property + value

Example:



 


Types of CSS

  1. Inline CSS (inside an HTML tag)

  2. Internal CSS (inside <style> tag in head)

  3. External CSS (separate .css file — best practice)


📌 CSS Example (Simple)

Here is an HTML page with CSS styling:


 


💡 What this CSS does?

  • Sets background color of whole page

  • Centers headline

  • Makes paragraph text blue and larger

You may also like...