How should you reference a font defined with @font-face in your CSS?

Prepare for the uCertify CIW Advanced HTML5 and CSS3 Specialist Exam. Dive into essential topics with flashcards and multiple-choice questions. Enhance your understanding with hints and explanations for each question. Pass your exam confidently!

Multiple Choice

How should you reference a font defined with @font-face in your CSS?

Explanation:
When you define a font with @font-face, you assign a name for that font using font-family inside that rule. That name is what you reference later in font-family for elements you want to use the font with. So you apply the font by its declared family name, not by the URL or the src there. For example, after creating @font-face { font-family: "CustomSans"; src: url("custom-sans.woff2"); }, you would write something like p { font-family: "CustomSans", Arial, sans-serif; }. The browser loads the font from the specified source and uses the named family you assigned. Using the URL directly in font-family or attempting to place src in font-family isn’t how font-family works, and font-weight is about choosing between different faces with the same family rather than selecting the font by itself. The essential idea is to reference the exact font-family name you defined in @font-face.

When you define a font with @font-face, you assign a name for that font using font-family inside that rule. That name is what you reference later in font-family for elements you want to use the font with. So you apply the font by its declared family name, not by the URL or the src there. For example, after creating @font-face { font-family: "CustomSans"; src: url("custom-sans.woff2"); }, you would write something like p { font-family: "CustomSans", Arial, sans-serif; }. The browser loads the font from the specified source and uses the named family you assigned. Using the URL directly in font-family or attempting to place src in font-family isn’t how font-family works, and font-weight is about choosing between different faces with the same family rather than selecting the font by itself. The essential idea is to reference the exact font-family name you defined in @font-face.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy