CSS Fonts
Other Font Properties
CSS also includes a number of other font properties, such as font-weight, font-style, and font-variant. These properties can be used to control the appearance of text in more detail.
For example, the following CSS rule will set the font weight of all <h1> elements to bold:
h1 {
font-weight: bold;
}
The following CSS rule will set the font style of all <h1> elements to italic:
h1 {
font-style: italic;
}
Task
Add property font-weight with value bold to ul selector. Add a combinator selector ol li with property font-style and value italic. Run the code to see the final results and experiment with the code to get used to it.
Conclusion
CSS fonts can be used to control the appearance of text on web pages. By understanding the different CSS font properties, you can create web pages that look the way you want them to look.
Here are some tips for using CSS fonts:
- Use a variety of fonts to create a visually appealing web page.
- Use font families to ensure that your web page looks good on different browsers and devices.
- Use font sizes to create a hierarchy of text on your web page.
- Use font colors to highlight important text on your web page.