Setting the Font Style and Weight
The font-weight property sets the weight of the font. It increases the weight makes the text bolder.
The font-style property selects between normal, italic, and oblique fonts.
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
<style>
p {
padding: 5px;
border: medium double black;
background-color: lightgrey;
margin: 2px;
float: left;
font-family: sans-serif;
font-size: medium;
}
#first {
font-weight: bold;
}
#second {
font-style: italic;
}
</style>
</head>
<body>
<p>
<span id="first">CSS</span>
<span id="second">HTML</span>
</p>
</body>
</html>
Home
HTML CSS Book
CSS
HTML CSS Book
CSS
Font:
- Font-related properties
- Selecting a Font with font-family
- Setting the Font Size
- Setting the Font Style and Weight
- Using Web Fonts
Related: