Setting the Font Size
The font-size property specifies the size of the font. The allowed values for this property are.
Value | Description |
---|---|
xx-small | Sets the font size to xx-small. The browser is deciding the exact size. |
x-small | Sets the font size to x-small. The browser is deciding the exact size. |
small | Sets the font size to small. The browser is deciding the exact size. |
medium | Sets the font size to medium. The browser is deciding the exact size. |
large | Sets the font size to large. The browser is deciding the exact size. |
x-large | Sets the font size to x-large. The browser is deciding the exact size. |
xx-large | Sets the font size to xx-large. The browser is deciding the exact size. |
smaller | Sets the font size smaller relative to the font size of the parent element. |
larger | Sets the font size larger relative to the font size of the parent element. |
<length> | Sets the font size precisely using a CSS length value. |
<%> | Sets the font size as a percentage of the parent element's font size. |
<!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-size: xx-large;
}
#second {
font-size: larger;
}
</style>
</head>
<body>
<p>
<span id="first">HTML</span>
<span id="second">CSS</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: