CSS font: family MCQs Quiz | Class 10
This quiz covers important Multiple Choice Questions (MCQs) for Class X Computer Applications (Code 165), specifically from Unit 2: HTML. The topic is ‘CSS font: family’ focusing on ‘Typeface family’. Test your knowledge and learn more about specifying fonts in CSS. After completing the quiz, submit your answers to see your score and download a PDF of the answer sheet for review.
Understanding CSS font-family Property and Typeface Families
The CSS font-family property is fundamental for controlling the appearance of text on a web page. It allows web developers to specify the priority list of font families or generic family names for the selected element. This ensures that if the user’s browser or operating system does not support the first font, it tries the next one in the list, providing a robust fallback mechanism.
Key Concepts of font-family
- Syntax: The property takes one or more font family names, separated by commas. Example:
font-family: "Times New Roman", Times, serif; - Specific Font Names: These are the names of specific fonts, like “Arial”, “Verdana”, “Times New Roman”, “Helvetica Neue”. If a font name contains spaces, it must be enclosed in single or double quotes.
- Generic Font Families: These are keyword values that specify a category of fonts, representing a common style. Browsers will use a default font from that category if no specific font is available. It is crucial to end every
font-familydeclaration with a generic family name as a universal fallback. - Fallback Mechanism: The browser attempts to apply fonts in the order they are listed. If the first font is not found, it moves to the second, and so on, until it finds an available font or defaults to the specified generic family.
Exploring Typeface Families
Typeface families are broadly categorized based on their visual characteristics. Understanding these categories helps in choosing appropriate fonts for different contexts and ensuring good readability and aesthetics.
-
Serif Fonts:
- Characteristics: Fonts in this family have small decorative strokes (serifs) at the end of the main strokes of characters. They are often associated with traditional print media, formality, and readability in long blocks of text.
- Examples: Times New Roman, Georgia, Palatino.
-
Sans-serif Fonts:
- Characteristics: These fonts lack the decorative serifs. They tend to have a cleaner, modern, and minimalist appearance. Sans-serif fonts are generally preferred for digital displays, headings, and short blocks of text due to their crispness on screens.
- Examples: Arial, Helvetica, Verdana, Open Sans.
-
Monospace Fonts:
- Characteristics: Every character in a monospace font occupies the same horizontal width. This makes them ideal for coding, tabular data, and situations where alignment is critical.
- Examples: Courier New, Consolas, Monaco.
-
Cursive Fonts:
- Characteristics: These fonts mimic human handwriting, often with connected or flowing letters. They are typically used for decorative purposes, invitations, or informal headings, but should be used sparingly for readability.
- Examples: Brush Script MT, Comic Sans MS (though often debated), Great Vibes.
-
Fantasy Fonts:
- Characteristics: These are highly decorative or artistic fonts that do not fit into other categories. They are often used for titles, logos, or specific themed designs, and usually have limited character sets.
- Examples: Impact, Copperplate Gothic Light, some gaming or themed fonts.
Generic Font Families Overview
| Generic Family | Description | Typical Use |
|---|---|---|
serif |
Fonts with small decorative strokes at the end of character lines. | Traditional, formal text, long content. |
sans-serif |
Fonts without decorative strokes, clean and modern. | Digital screens, headings, clean design. |
monospace |
All characters have the same width. | Code blocks, data tables, programming. |
cursive |
Fonts that resemble human handwriting. | Decorative, informal headings, invitations. |
fantasy |
Highly decorative or unique fonts. | Titles, logos, specific themed designs. |
Quick Revision: What to Remember
- Always provide a fallback list for
font-family. - End your
font-familylist with a generic family. - Quote font names with spaces (e.g., “Times New Roman”).
- Understand the visual impact of serif vs. sans-serif fonts.
- Monospace is great for code, Cursive and Fantasy for decoration.
Extra Practice Questions
- Which property is typically used to set the font size of text in CSS?
- If a user’s system does not have the font ‘CustomFont’, which font will the browser try to use next based on
font-family: 'CustomFont', Arial, sans-serif;? - Which generic font family is best suited for displaying code snippets?
- What is the significance of including a generic font family as the last option in a
font-familydeclaration? - Explain the difference between a specific font name and a generic font family.