What is the purpose of the `font-family` property in CSS?
A
To set the text color B
To align text C
To specify the font used for text D
To bold the text
Analysis & Theory
`font-family` specifies the typeface to be used for an element's text.
Which of the following is the correct syntax to set a primary and fallback font?
A
font-family: Arial Helvetica sans-serif; B
font-family: Arial, Helvetica, sans-serif; C
font-family: 'Arial' | 'Helvetica' | sans-serif; D
font: Arial, Helvetica, sans-serif;
Analysis & Theory
Font names are separated by commas, and generic families should be last.
Why do we include multiple fonts in `font-family`?
A
To improve performance B
To change font size dynamically C
To provide fallbacks if the first font is unavailable D
To set text color
Analysis & Theory
If the first font isn't available on the user's system, the next one is used.
Which of the following is a valid generic font family?
A
sans-serif B
Roboto C
Times D
Helvetica Neue
Analysis & Theory
`sans-serif` is one of the generic font families defined in CSS.
Which value of `font-family` is best used as a fallback?
A
Comic Sans MS B
Times New Roman C
sans-serif D
Courier New
Analysis & Theory
Generic families like `sans-serif` should always be included as final fallbacks.
How should font names with spaces be written in CSS?
A
font-family: Times New Roman; B
font-family: 'Times New Roman'; C
font-family: Times-New-Roman; D
font-family: Times_New_Roman;
Analysis & Theory
Font names with spaces must be enclosed in quotes.
Which is a proper use of `font-family` with quotes and generics?
A
font-family: Arial, Times New Roman, serif; B
font-family: 'Arial', 'Times New Roman', serif; C
font-family: Arial Times New Roman serif; D
font-family: Arial | Times New Roman | serif;
Analysis & Theory
Quoted font names are correct when they include spaces, followed by a generic family.
Which font-family declaration is **not valid**?
A
font-family: 'Open Sans', sans-serif; B
font-family: Courier, monospace; C
font-family: Arial, Verdana, serif; D
font-family: Times New Roman, serif
Analysis & Theory
Font names with spaces like `Times New Roman` must be quoted.
What is the best way to apply a custom Google Font in `font-family`?
A
Just use the font name B
Include the Google Font in HTML and refer using `font-family` C
Use `font: GoogleFont;` D
Only use it in HTML's `<font>` tag
Analysis & Theory
You must include a `<link>` to the Google Font, then use its name in `font-family`.
What happens if none of the specified fonts in `font-family` are available?
A
Text will not appear B
The default browser font will be used C
It shows an error D
It loads web fonts automatically
Analysis & Theory
If all fonts fail, the browser uses its default font.