When you visit a website, you probably don't consciously think about every detail of the text you're reading.
You simply read it.
But what if the text were extremely small? What if the lines were packed tightly together? What if the font was difficult to recognize? What if the colour had poor contrast with the background?
You might struggle to read the content—or leave the website altogether.
This is one reason CSS typography is so important in web development.
CSS doesn't just make a webpage look attractive. It gives developers control over how text is presented, helping users read, scan, understand, and navigate information.
In this beginner-friendly guide, we'll look at some of the most important CSS properties used to control text appearance, including:
- color
- background-color
- font-family
- font-size
- font-weight
- line-height
- letter-spacing
- text-align
- text-decoration
Let's get started.
What Is CSS Typography?
Typography refers to the way written text is arranged and presented.
In web development, CSS typography involves using CSS properties to control things such as:
- Font type
- Font size
- Font thickness
- Text colour
- Line spacing
- Character spacing
- Text alignment
- Text decoration
HTML provides the structure of your content.
For example:
Welcome to My Website
This is my first paragraph.
HTML tells the browser:
This is a heading.
and:
This is a paragraph.
CSS then allows you to decide how those elements should appear.
For example:
h1 {
font-size: 36px;
font-weight: 700;
color: navy;
}
p {
font-size: 18px;
line-height: 1.6;
}
Now the content has a visual hierarchy and is easier to read.
- The
colorProperty
The color property controls the colour of text.
For example:
p {
color: #333;
}
This makes the paragraph text a dark grey.
You can use named colours:
h1 {
color: blue;
}
Hexadecimal colours:
h1 {
color: #800020;
}
Or other CSS colour formats such as RGB and HSL.
Why does text colour matter?
Because readability depends partly on the relationship between your text colour and its background.
For example, light grey text on a white background may look subtle, but it can be difficult to read.
Good typography considers both appearance and accessibility.
Instead of asking:
Does this colour look attractive?
also ask:
Can people comfortably read this text?
- The
background-colorProperty
background-color controls the background colour of an element.
For example:
p {
background-color: #f5f5f5;
}
The paragraph's box will have a light background behind the text.
You might also use it for headings:
h1 {
background-color: lightyellow;
}
Or for an entire section:
section {
background-color: #f5f5f5;
}
Remember that background-color applies to the element's box. It isn't a separate colour applied only to the individual characters.
Background and text colours should work together.
A beautiful background is not useful if the text placed on top of it becomes difficult to read.
- The
font-familyProperty
Have you ever noticed that different websites seem to have completely different personalities?
Some look formal.
Others look playful.
Some look modern and minimal.
Typography plays a major role in creating that feeling.
The font-family property determines which typeface the browser should use.
For example:
body {
font-family: Arial, sans-serif;
}
You can also provide multiple fonts as fallbacks:
body {
font-family: "Helvetica Neue", Arial, sans-serif;
}
The browser will try to use the first available font and move through the list if necessary.
Why does font choice matter?
Font choice affects:
- Readability
- Visual hierarchy
- Brand personality
- Professional appearance
- Overall consistency
However, choosing a font shouldn't become a competition to find the most unusual typeface.
A font can look beautiful and still be uncomfortable to read.
For body text especially, readability should be a major consideration.
- The
font-sizeProperty
As the name suggests, font-size controls how large or small text appears.
For example:
p {
font-size: 18px;
}
You can also use other CSS units such as rem , em , % , or responsive units depending on the situation.
For example:
h1 {
font-size: 2rem;
}
Different types of content may require different sizes.
A main heading should normally stand out more than a paragraph.
For example:
h1 {
font-size: 2.5rem;
}
h2 {
font-size: 2rem;
}
p {
font-size: 1rem;
}
This creates a visual hierarchy.
The visitor can quickly recognize:
Main heading → Subheading → Body text
That's useful because people don't always read webpages word for word.
They often scan them first.
- The
font-weightProperty
font-weight controls the weight or thickness of text.
For example:
h1 {
font-weight: 700;
}
A higher value generally produces a heavier weight when the chosen font provides that weight.
You can also use keywords such as:
font-weight: normal;
or:
font-weight: bold;
Weight can help establish hierarchy.
For example, you might use a heavier weight for headings and a regular weight for paragraphs.
h1 {
font-weight: 700;
}
p {
font-weight: 400;
}
The result is a clearer distinction between important headings and supporting information.
But heavier doesn't always mean better.
If everything on a webpage is bold, nothing feels particularly important.
- The
line-heightProperty
This is one of the most useful properties for readable paragraphs.
line-height controls the height of the line boxes, affecting the vertical space between lines of text.
Consider this:
p {
line-height: 1.6;
}
Compared with tightly packed text, the paragraph will generally feel more open and comfortable to read.
For example:
p {
font-size: 16px;
line-height: 1.6;
}
This is particularly useful for:
- Blog articles
- Documentation
- News websites
- Long-form content
- Educational websites
If the line height is too small, paragraphs can feel cramped.
If it is excessively large, the relationship between lines can become harder to follow.
The goal is balance.
- The
letter-spacingProperty
letter-spacing controls the space between characters.
For example:
h1 {
letter-spacing: 1px;
}
This slightly increases the spacing between characters.
You can also reduce spacing:
h1 {
letter-spacing: -0.5px;
}
Letter spacing can be useful for headings, labels, navigation items, and other short pieces of text.
For example, uppercase headings sometimes use a little additional letter spacing:
.logo {
letter-spacing: 2px;
}
However, excessive letter spacing can make words difficult to recognize as a unit.
Use it intentionally rather than simply because you can.
- The
text-alignProperty
text-align controls the horizontal alignment of inline content within its containing block.
Common values include:
text-align: left;
text-align: center;
text-align: right;
and:
text-align: justify;
For example:
h1 {
text-align: center;
}
This centres the heading.
A common mistake beginners make is assuming that centred text automatically looks better.
It doesn't.
Center alignment can work well for:
- Short headings
- Hero sections
- Promotional messages
- Certain landing-page designs
But large blocks of centred body text can become harder to scan.
The correct choice depends on the content and layout.
- The
text-decorationProperty
text-decoration controls decorative lines associated with text.
For example:
a {
text-decoration: underline;
}
You can also remove an underline:
a {
text-decoration: none;
}
Other decoration types include:
- Underline
- Overline
- Line-through
For example:
del {
text-decoration: line-through;
}
Links often use underlines because they provide a visual clue that the text is clickable.
If you remove underlines from links, make sure there is another clear way for users to identify interactive elements.
Putting Everything Together
Now let's combine several properties into a simple example.
HTML:
Learn Web Development
Web development allows you to build websites and web applications
that people can interact with online.
CSS:
article {
background-color: #f5f5f5;
}
h1 {
color: #800020;
font-family: Arial, sans-serif;
font-size: 2rem;
font-weight: 700;
text-align: center;
}
p {
color: #333;
font-family: Arial, sans-serif;
font-size: 1rem;
line-height: 1.6;
letter-spacing: 0.2px;
}
Notice how each property has a specific job.
color controls the colour.
font-family controls the typeface.
font-size controls the size.
font-weight controls the thickness.
line-height controls the vertical rhythm of the text.
letter-spacing controls character spacing.
text-align controls alignment.
background-color controls the background of the article.
Together, these properties create a more organized reading experience.
CSS Typography Is About More Than Beauty
This is one of the biggest lessons beginners should understand.
CSS isn't simply about making a webpage pretty.
Good typography helps users:
Read.
Scan.
Understand.
Navigate.
Focus on important information.
Imagine an article with one font size, one weight, no spacing, poor colour contrast, and extremely tight paragraphs.
Even if the information is excellent, many visitors may not want to read it.
Now imagine the same information with:
- Clear headings
- Comfortable body text
- Appropriate line spacing
- Good contrast
- Consistent font choices
- Useful visual hierarchy
The information becomes much easier to consume.
That's the real value of CSS typography.
Common Typography Mistakes Beginners Make
- Making everything large
If every piece of text is huge, your page loses hierarchy.
Different text elements should have different levels of importance.
- Using too many fonts
Five different fonts on one webpage can quickly make the design feel inconsistent.
A small, intentional type system is often easier to manage.
- Making paragraphs too bold
Bold text should communicate emphasis.
If every paragraph is bold, emphasis disappears.
- Ignoring line height
Beginners often focus on font size while forgetting the space between lines.
A readable font with poor line spacing can still produce an uncomfortable reading experience.
- Choosing colours based only on appearance
A colour combination might look stylish but still have poor readability.
Always consider contrast.
- Centre-aligning everything
Centred text can work beautifully in the right context.
But using it for every paragraph can make long-form content harder to scan.
- Removing link underlines without another visual cue
If users can't easily recognize clickable text, navigation becomes less obvious.
Design should communicate interaction clearly.
A Simple Typography Checklist for Beginners
Before publishing a webpage, ask yourself:
Is the text easy to read?
Check the font size, font choice, colour, and line height.
Is there a clear hierarchy?
Can users quickly distinguish headings from supporting text?
Is the contrast sufficient?
Can the text be comfortably distinguished from its background?
Is the typography consistent?
Are similar elements styled in similar ways?
Does it work on smaller screens?
A design that looks good on a desktop-sized screen may not feel comfortable on a phone.
Are important elements easy to find?
Headings, links, buttons, and important information should have enough visual distinction.
These questions can prevent many common typography problems.
The Bigger Picture: CSS Helps People Understand Information
When beginners learn CSS, they sometimes think about properties individually:
font-size changes size.
color changes colour.
font-weight makes text thicker.
That's technically correct, but there's a bigger picture.
These properties work together to create visual communication.
A heading tells you:
This is important.
A larger font tells you:
Pay attention to this.
Spacing tells you:
These pieces of information are related—or separate.
A bold word tells you:
This deserves emphasis.
A link tells you:
You can interact with this.
Good typography therefore isn't just decoration.
It's part of how a website communicates with its users.
Final Thoughts
CSS gives web developers remarkable control over the appearance and readability of text.
With properties such as:
- color
- background-color
- font-family
- font-size
- font-weight
- line-height
- letter-spacing
- text-align
- text-decoration
you can create text that is clearer, more organized, more readable, and more visually consistent.
But don't fall into the trap of thinking that good typography means adding more styles.
Sometimes the best typography is surprisingly simple.
Choose a readable font.
Use appropriate sizes.
Create clear hierarchy.
Give paragraphs enough breathing room.
Use colour carefully.
And always think about the person who will actually read the page.
Because the goal of CSS typography isn't simply:
“Make the text look good.”
The goal is:
“Make the information easy to understand.”
And that's a much more important skill for any web developer to learn.
What CSS Typography Property Would You Learn First?
If you're just starting with CSS, which property do you find most interesting?
font-size ? font-family ? line-height ? font-weight ?
Share your answer in the comments.


