Master CSS From Scratch

Clear, interactive, and structured CSS lessons designed for beginners.

Text & Fonts

CSS provides properties to control the appearance, alignment, size, spacing, and font style of text.

With CSS, we can make text easier to read and create attractive and well-structured web pages.

How CSS Text & Fonts Work

HTML Text Heading / Paragraph
→
CSS Text & Font Properties color / font-size / alignment
→
Styled Text Browser Output

Example 1: Text Color

The color property changes the color of text.

CSS Code
h1 {
    color: blue;
}
Output

WELCOME TO CIIT TRAINING INSTITUTE 🌍

Example 2: Font Size

The font-size property controls the size of text.

CSS Code
h2 {
    font-size: 32px;
}
Output

Learn CSS

Example 3: Text Alignment

The text-align property controls the horizontal alignment of text.

CSS Code
p {
    text-align: center;
}
Output

CSS makes text easy to organize.

Common Text & Font Properties

Property Purpose
color Changes the text color.
font-family Specifies the font type.
font-size Controls the size of text.
font-weight Controls how bold the text appears.
text-align Controls text alignment.
text-decoration Adds underline, overline, or line-through.

Simple Explanation

color → Changes the text color.

font-size → Changes the text size.

font-family → Changes the font style.

font-weight → Makes text normal or bold.

text-align → Aligns text left, center, right, or justify.

Summary

  • CSS can control the appearance of text.
  • Use color to change text color.
  • Use font-size to change text size.
  • Use font-family to select a font.
  • Use text-align to align text.