| Font Families and Font Sizes |
|
1-9 A 1 Discover In the Exercises01 folder, create an HTML file with these lines of code: <html> </body> Open this file in a browser and explain the font-family property: |
|
1-9 Explanation 1: The font-family property The font-family property specifies the font type for an element. |
|
1-9 Explanation 2: Values for the font-family property Some property values of the font-family property are:
Note that values consisting of multiple words must be enclosed in single quotes: '. |
|
1-9 Explanation 3: Font-family value case Property values are typically written in lowercase letters. However, font-family values start with an uppercase letter for better readability |
|
1-9 Example 1: Property values for the font-family property Here are some values for the font-family property. The font styles used here can be applied in the opening tags of HTML tag pairs like <h1></h1>, <h2></h2> and so on, the paragraph tag pair<p></p>, or the span tag pair<span></span>. This example uses the paragraph tag pair.
|
|
1-9 A 2
Using the Courier property value create an HTML file that shows this content: This is a little text. |
|
1-9 A 3
Create an HTML file that shows this content:
|
|
1-9 A 4 Discover Create an HTML file with this code: <html> </body> Open this file in a browser and explain the font-size property: |
|
1-9 Explanation 4: The font-size property The font-size property specifies the font size for an element. |
|
1-9 Example 2: Property values for the font-size property Here are some examples for value types of the font-size property:
|
|
1-9 Explanation 5: Property values for the font-size property For the property values of font-size property you can use whole numbers, percent pixels: px or words like small, medium or large. |
|
1-9 A 5
Using size 55px create an HTML file that shows this content: This is a big text. |
|
1-9 Explanation 6: Several attributes in one tag Both the font family and font size styles can be included in one element. |
|
1-9 A 6
Using the font-family Arial and the font-size 80% create an HTML file that displays this content: This is a little text. |
|
1-9 A 7 Create an HTML file with this code: <html> <ol style="font-size:150%;" font-family:Courier;> </body> Open this file in a browser and explain the above lines of code: |
|
1-9 Explanation 7: Font tag pair in list tag pair Both the font family and the font size styles can be used in the list tag pair. |
|
1-9 Orientation 2: HTML files from previous exercises In the Exercises01 folder, create a copy of the corresponding previous HTML file for each of the following four exercises, and rename each copied HTML file, using the exercise numbers of the following exercises. Apply the styles specified in the exercises. |
|
1-9 A 8 Cats.html Apply the Courier font to the title and the following text. Additionally, set the text under the title to a smaller size. |
|
1-9 A 9 Dogs.html Apply the Consolas font to the title and use Verdana for the text under the title. |
|
1-9 A 10 Birds.html Apply the Arial font to the title and use Courier for the text. |
|
1-9 A 11 Your own HTML file Modify your own file with various fonts and sizes. |
|
1-9 A 12 Rereading the yellow sections Now that you have gone through the exercises on this page, reread the yellow sections. |
1-9 A 13
StarfruitJuice08.html
At this point you have 2 identical files, named StarfruitJuice07.html and StarfruitJuice08.html.
|
|
This page was created by Hanspeter Amend
|
|
|
Solution proposals 1-9 A 2 <html> <body> <p style= "font-family:Courier;">This is a little text.</p> </body> 1-9 A 3 <html> <!--List of different font families --> 1-9 A 5 <html> <p style="font-size:55px;">This is a big text.</p> </body> 1-9 A 6 <html> <p style="font-size:80%;font-face="Arial">This is a little text.</p> </body> 1-9 A 13 <html> <!- - Title: Set style attribute for text style. - -> <!- - Line break - -> <!- - Paragraph - -> <!- - Set heading - -> <!- - Set style attribute for font styles. - -> <!- - Set style attribute for list style and font styles. - -> </html> |
|