29,99 €
In this book "CSS Typography and Web Fonts" we explore the CSS typography properties that control font sizes, line heights, letter spacing and more...
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 20
Veröffentlichungsjahr: 2024
CSS Typography and Web Fonts
Abdelfattah Ragab
Welcome to the book "CSS Typography and Web Fonts".
In this book I will explain the CSS typography properties that control font sizes, line heights, letter spacing and so on.
By the end of this book, you will be able to insert your custom fonts into your web applications, change the font properties and handle all kinds of scenarios.
Let us go!
The font-family property defines the font for an element.
The font-family property can contain several font names as a "fallback" system. If the browser does not support the first font, it tries the next font.
There are two types of font family names:
Start with the desired font and always end with a generic family so that the browser can select a similar font from the generic family if no other fonts are available.
Separate the individual values with a comma.
If the name of a font contains spaces, it must be enclosed in quotation marks as follows:font-family: "Times New Roman", serif;
<style>
p {
font-size: 30px;
font-family: Arial, Helvetica, sans-serif;
}
</style>
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Minus magni alias
odit quia optio quae eaque, sed enim a laboriosam numquam neque velit qui
maiores quos nostrum facere in ab. Reiciendis, nostrum obcaecati dolore vel
nam quidem molestias eos magnam quibusdam aliquid accusamus sed nesciunt
necessitatibus commodi voluptatum similique et!
</p>
The font-size property sets the size of a font.
Set the font size to a medium size.
p {
font-size: medium;
}
Sets the font-size to a fixed size in px, cm, etc.
p {
font-size: 30px;
}
Sets the font-size to a percent of the parent element's font size.
p {
font-size: 80%;
}
The font-weight CSS property sets the weight (or boldness) of the font. The weights available depend on the font-family that is currently set.