Lesson 3.5: Text Styling & Google Fonts
In this lesson, you will learn how to style text in CSS and use Google Fonts to make your website typography more attractive. Text styling is one of the most important parts of web design because it directly affects readability and user experience.
1. Basic Text Styling Properties
CSS provides several properties to style text.
a) Color
-
Changes the text color.
b) Font-Family
-
Defines the font style for text.
c) Font-Size
-
Controls the size of the text.
d) Font-Weight
-
Makes text bold or light.
e) Font-Style
-
Controls italic or normal style.
f) Text-Align
-
Aligns text to left, right, center, or justify.
g) Text-Decoration
-
Adds or removes underlines, overlines, etc.
h) Line-Height
-
Controls spacing between lines.
2. Google Fonts
Google Fonts is a free library of fonts that can be directly used in websites.
Steps to Use Google Fonts:
-
Visit: https://fonts.google.com
-
Select a font (e.g., “Roboto”).
-
Copy the
<link>tag given by Google Fonts. -
Add it inside the
<head>of your HTML. -
Use the font in CSS:
3. Example: Applying Text Styles and Google Fonts
✅ Summary
-
Use CSS properties like
font-family,font-size,color,text-alignto style text. -
Google Fonts provides free, modern fonts to make websites look professional.
-
Always choose fonts that are readable and match your website theme.
