Loading…
Everything will be ready in few seconds
- Theory
- Theory
- Comments
The font-size property
In last chapter, we learned about the basic mechanisms of CSS. However, we did not consider the details of how the individual CSS properties function. Therefore, this chapter will provide you with a complete immersion course in CSS. We will start with the design of what forms the basis of any page on the Internet: typography.
The most important “textual” parameter that can be controlled is the font. Let’s analyze these properties in order, including what kind of font and what size, typeface, and font weight can be set.
The font size is controlled by the font-size
property. The property value sets the desired height of the font character. Moreover, the units of measurement can be absolute or relative. We have already considered units of measurement in one of the assignments from the previous chapter. They are also relevant for working with font sizes.
The most commonly used font size unit is the pixel (px
):
p {
font-size: 20px;
}
In fact, you can specify an absolute value for the font size not only in pixels, points, and other values, but also by using special “font” keywords: xx-small
, x-small
, small
, medium
, large
, x-large
, and xx-large
. In practice, these units are rarely used. You can learn the details of how these keywords are used in the specification.
- day-2.html
- style.css
Thanks! We’ll fix everything at once!
The code has changed, click “Refresh” or turn autorun on.
You’ve gone to a different page
Click inside the mini-browser to shift the focus onto this window.
Comments