Fonts The following CSS properties will be described: 1.Font-family 2.Font-style 3.Font-variant...
-
Upload
junior-pearson -
Category
Documents
-
view
223 -
download
5
Transcript of Fonts The following CSS properties will be described: 1.Font-family 2.Font-style 3.Font-variant...
![Page 1: Fonts The following CSS properties will be described: 1.Font-family 2.Font-style 3.Font-variant 4.Font-weight 5.Font-size 6.Font.](https://reader035.fdocuments.in/reader035/viewer/2022071808/56649ef45503460f94c0708e/html5/thumbnails/1.jpg)
Introduction to CSSChapter No: 03“CSS-Fonts”
Course Instructor:ILTAF MEHDI
IT Lecturer, MIHE, Kart-i Parwan branch, Kabul
CASCADING STYLE SHEET
![Page 2: Fonts The following CSS properties will be described: 1.Font-family 2.Font-style 3.Font-variant 4.Font-weight 5.Font-size 6.Font.](https://reader035.fdocuments.in/reader035/viewer/2022071808/56649ef45503460f94c0708e/html5/thumbnails/2.jpg)
Fonts
The following CSS properties will be described:1. Font-family2. Font-style3. Font-variant4. Font-weight5. Font-size6. Font
![Page 3: Fonts The following CSS properties will be described: 1.Font-family 2.Font-style 3.Font-variant 4.Font-weight 5.Font-size 6.Font.](https://reader035.fdocuments.in/reader035/viewer/2022071808/56649ef45503460f94c0708e/html5/thumbnails/3.jpg)
Font family [font-family]• The property font-family is used to set a
prioritized list of fonts to be used to display a given element or web page.
• If the first font on the list is not installed on the computer used to access the site, the next font on the list will be tried until a suitable font is found.
• An example of a prioritized list of fonts could look like this:
h1 {font-family: arial, verdana, sans-serif;} h2 {font-family: "Times New Roman", serif;}
![Page 4: Fonts The following CSS properties will be described: 1.Font-family 2.Font-style 3.Font-variant 4.Font-weight 5.Font-size 6.Font.](https://reader035.fdocuments.in/reader035/viewer/2022071808/56649ef45503460f94c0708e/html5/thumbnails/4.jpg)
Font style [font-style]
• The property font-style defines the chosen font either in normal, italic or oblique.
• In the example below, all headlines marked with <h2> will be shown in italics.
h1 {font-family: arial, veranda, sans-serif;} h2 {font-family: " arial", serif; font-style: italic;}
![Page 5: Fonts The following CSS properties will be described: 1.Font-family 2.Font-style 3.Font-variant 4.Font-weight 5.Font-size 6.Font.](https://reader035.fdocuments.in/reader035/viewer/2022071808/56649ef45503460f94c0708e/html5/thumbnails/5.jpg)
Font variant [font-variant]
• The property font-variant is used to choose between normal or small-caps variants of a font.
• A small-caps font is a font that uses smaller sized capitalized letters (upper case) instead of lower case letters.
h1 {font-variant: small-caps;} h2 {font-variant: normal;}
![Page 6: Fonts The following CSS properties will be described: 1.Font-family 2.Font-style 3.Font-variant 4.Font-weight 5.Font-size 6.Font.](https://reader035.fdocuments.in/reader035/viewer/2022071808/56649ef45503460f94c0708e/html5/thumbnails/6.jpg)
Font weight [font-weight]
• The property font-weight describes how bold or "heavy" a font should be presented.
• A font can either be normal or bold. • Some browsers even support the use of
numbers between 100-900 (in hundreds) to describe the weight of a font.
p {font-family: arial, verdana, sans-serif;}
td {font-family: arial, verdana, sans-serif; font-weight: bold;}
![Page 7: Fonts The following CSS properties will be described: 1.Font-family 2.Font-style 3.Font-variant 4.Font-weight 5.Font-size 6.Font.](https://reader035.fdocuments.in/reader035/viewer/2022071808/56649ef45503460f94c0708e/html5/thumbnails/7.jpg)
Font size [font-size]
• The size of a font is set by the property font-size.
• There are many different units (e.g. pixels and percentages) to choose from to describe font sizes.
h1 {font-size: 30px;} h2 {font-size: 12pt;} h3 {font-size: 120%;}
![Page 8: Fonts The following CSS properties will be described: 1.Font-family 2.Font-style 3.Font-variant 4.Font-weight 5.Font-size 6.Font.](https://reader035.fdocuments.in/reader035/viewer/2022071808/56649ef45503460f94c0708e/html5/thumbnails/8.jpg)
Compiling [font]• Using the font short hand property it is
possible to cover all the different font properties in one single property.
• For example, imagine these four lines of code used to describe font-properties for <p>:p { font-style:
italic; font-weight:
bold; font-size: 30px; font-family:
arial, sans-serif;
}
Using the short hand property, the code can be simplified:p { font: italic bold 30px arial, sans-serif; }
The order of values for font is:font-style | font-variant | font-weight | font-size | font-family