How can you specify a fallback font if the primary font fails to load?
- Add the "secondary" attribute to the "font" property
- Define a secondary font using the "secondary-font" property
- Use the "fallback-font" property
- Utilize the "font-family" property with multiple font options
To specify a fallback font in case the primary font fails to load, you can use the "font-family" property with multiple font options. You list the preferred font first and then provide alternatives separated by commas. If the primary font is unavailable, the browser will attempt to use the next font in the list until it finds a suitable option or defaults to a system font.
What is the role of the src attribute inside the @font-face rule?
- Defines the font color
- Sets the font style
- Specifies the font size
- Specifies the font's source file location
Inside the @font-face rule, the "src" attribute is used to specify the font file's source location. This attribute tells the browser where to find and load the font file, allowing you to use custom fonts in your web design. It typically points to the location of a font file using a URL or local file path.
How do you specify the duration of a transition effect in CSS?
- duration
- time-duration
- transition-duration
- transition-time
To specify the duration of a transition effect in CSS, you use the transition-duration property. This property defines the amount of time it takes for the transition to complete. You can specify the duration using units like seconds (s) or milliseconds (ms). For example, transition-duration: 0.5s; sets the transition duration to half a second.
What's the primary difference between the clip-path and mask properties in CSS?
- Clip-path works on images, while the mask property only works on text elements.
- The clip-path property can be animated, while the mask property cannot.
- The clip-path property clips an element to a specified shape, while the mask property applies an image as a mask to an element.
- The clip-path property is used for simple shapes, while the mask property is used for complex shapes.
The primary difference between clip-path and mask in CSS is that clip-path clips an element to a specified shape, whereas the mask property applies an image as a mask to an element. This fundamental distinction affects how elements are visually modified and displayed.
How does the SMACSS methodology recommend handling states, like "is-active" or "is-hidden"?
- Apply these states as classes in the HTML
- Avoid handling states in SMACSS
- Use JavaScript to toggle these states
- Utilize pseudo-elements like :active or :hidden
In the SMACSS (Scalable and Modular Architecture for CSS) methodology, states like "is-active" or "is-hidden" are typically handled by applying them as classes directly in the HTML markup. This allows for clear separation of styling and behavior, making the code more maintainable and modular.
Which property in CSS determines the space outside an element?
- Border
- Content
- Margin
- Padding
In CSS, the 'margin' property is used to determine the space outside an element. It creates spacing around the element, separating it from other elements in the layout.
When an element's property is set to initial, it will use the ________.
- Current value
- Default value
- Inherited value
- Parent element's value
Setting an element's property to 'initial' means it will use the default value for that property as defined by the CSS specification. This effectively resets the property to its default state.
Which of the following properties, when animated, would cause a "repaint" but not "reflow" in most browsers?
- color
- margin
- position
- width
When animated, changing the color property of an element typically causes a "repaint" (updating the pixels on the screen) but not a "reflow" (changing the layout of elements on the page). This is because changing the color doesn't affect the size or position of the element, but it does require repainting.
When using a mixin, you apply it to your styles with the ________ directive.
- @apply
- @extend
- @mixin
- @use
Mixins in SCSS are applied to your styles using the @include directive. This allows you to include the styles defined in the mixin within your CSS rules.
Which CSS property is used to vertically align inline elements or inline-block elements?
- margin
- padding
- text-align
- vertical-align
The CSS property used to vertically align inline elements or inline-block elements is vertical-align. It allows you to control how the element aligns in relation to the surrounding content or other inline elements. It's commonly used for aligning elements such as images and text within a line of text.