Which property allows you to control the size of tracks in a grid layout?
- grid-row: auto;
- grid-template-columns;
- grid-template-rows;
- grid-track: size;
The property that allows you to control the size of tracks (rows and columns) in a grid layout is 'grid-template-columns' for columns and 'grid-template-rows' for rows. These properties let you define the size of the grid tracks using various units like pixels, percentages, or 'fr' units.
What does the CSS property "font-display" control?
- How much space a font file occupies on the server
- How quickly a font is loaded and rendered on a web page
- The color and style of text
- The size of text
The "font-display" property in CSS controls how web fonts are displayed during loading. It's used to manage the flash of unstyled text (FOUT) or invisible text, making it an essential property for optimizing web font performance. Setting it to "swap" tells the browser to use a system font until the custom font is available, reducing FOUT.
How would you make an animation run indefinitely in CSS?
- Set animation-iteration to infinite.
- Set the animation-delay property to a very large value.
- Use animation-loop property and set it to true.
- Use the animation-duration property and set it to infinite.
To make an animation run indefinitely in CSS, you should use the animation-duration property and set it to infinite. This property specifies the time it takes for one cycle of the animation, and when set to infinite, it ensures that the animation continues to run indefinitely.
Which pseudo-class in CSS is used to target elements based on their position in a parent element, like the first child?
- :element-first
- :first-child
- :nth-element(1)
- :parent
The :first-child pseudo-class in CSS is used to target elements that are the first child of their parent element. It is commonly used to apply styles to the first element in a list or container. This selector is useful for creating specific styles for the first child within a parent.
How can you ensure that the animation effects persist after the animation completes its execution?
- By adding "animation-play-state: running;"
- By setting "animation-direction" to "alternate."
- By setting the "animation-fill-mode" property to "forwards."
- By using "animation-iteration-count: infinite."
To ensure that the animation effects persist after the animation completes, you should set the "animation-fill-mode" property to "forwards." This will make the animation retain its final state after completing its execution.
Which CSS property is used to create animations by gradually changing from one set of CSS styles to another?
- animate
- animate-duration
- animation-duration
- keyframes
The CSS property used to create animations by gradually changing from one set of CSS styles to another is keyframes. Keyframes are used to define a sequence of style changes over a specified duration using the @keyframes rule. The animation duration can be controlled by the animation-duration property.
You have a style rule with a class selector that is not being applied, even though another rule with three type selectors is applied to the same element. What could be the reason based on specificity?
- Class selectors have higher specificity than type selectors.
- Specificity is not a factor in CSS rule application.
- The order of the rules in the stylesheet determines the application.
- Type selectors have higher specificity than class selectors.
In CSS, class selectors have higher specificity than type selectors. Therefore, if a class selector rule is not being applied, but a rule with three type selectors is, it's likely because the class selector rule has a lower specificity.
In the context of CSS masking, what does the mask-composite property do?
- Combines a mask image with the element using the blend mode specified.
- Defines the shape of the mask by specifying a path.
- Determines the transparency of the mask image.
- Specifies the position of the mask image relative to the masked element.
The mask-composite property in CSS is used to determine how a mask image should be combined with the element it's applied to. It's used to control the blending mode of the mask image with the element, allowing for various effects.
You're working on a responsive design where you want a row of items to wrap onto the next line when there isn't enough space. Which Flexbox properties would you adjust?
- align-content and flex-basis
- flex-direction and flex-wrap
- justify-content and align-items
- order and flex-grow
To make a row of items wrap onto the next line when there isn't enough space in a Flexbox layout, you would adjust the flex-direction property to "column" (for vertical stacking) and flex-wrap to "wrap." This allows the items to stack vertically when space is limited.
How can you pause an animation before it begins or between iterations?
- animation-delay
- animation-hold
- animation-pause
- animation-play-state
To pause an animation before it begins or between iterations, you should use the animation-play-state property. By setting it to paused, you can temporarily halt the animation. This is useful for creating interactive animations and controlling when they start or stop.