To run animations in reverse order after they complete, the value for animation-direction should be ________.
- alternate
- backwards
- normal
- reverse
The value for the animation-direction property determines how animations behave after they complete. To run animations in reverse order after completion, you should set animation-direction to reverse. This will play the animation backward.
How would you define a custom property (or variable) in CSS?
- #variable: value;
- $variable: value;
- --variable: value;
- @variable: value;
To define a custom property (or variable) in CSS, you use the format --variable: value;. Custom properties start with a double hyphen (--) and are followed by the property name, a colon, and the value. These custom properties can then be used to store and reuse values throughout your stylesheet.
Which CSS property is used to define a container as a grid layout?
- display: grid;
- grid-container
- grid-style
- grid-template
To define a container as a grid layout, you should use the display: grid; CSS property. This property tells the browser to treat the specified container as a grid, enabling you to create grid-based layouts within it.
You're working on a navigation menu where each list item should be displayed side by side. How would you achieve this using CSS?
- Using the display: block; property.
- Using the display: flex; property.
- Using the display: grid; property.
- Using the display: inline; property.
To display list items side by side in a navigation menu, you should use the display: flex; property on the parent container of the list. This allows for a horizontal layout of the list items.
When you want flex items to stack vertically, you set flex-direction to ________.
- Column
- Column-reverse
- Row
- Row-reverse
To make flex items stack vertically in a Flexbox container, you set flex-direction to column. This means the items will be arranged one below the other, creating a vertical stack.
For an element with position: sticky; to work, the parent container must have a defined ________.
- Height
- Margin
- Overflow
- Position
For an element with position: sticky; to work, the parent container must have a defined overflow property (e.g., overflow: auto;). This allows the element to stick within the scrolling container when it reaches a certain point, behaving as if it's "stuck" to the viewport.
How does SMACSS (Scalable and Modular Architecture for CSS) categorize its styles?
- By alphabetical order
- By color
- By position in the HTML
- By specificity
SMACSS categorizes its styles by specificity. In SMACSS, styles are organized into five categories: Base, Layout, Module, State, and Theme. This categorization helps in creating a scalable and maintainable CSS architecture by defining how styles should be applied and structured.
You are designing a responsive website and want a box to always be 10% of the viewport width. Which CSS value would you use?
- %
- em
- px
- vw
To make a box 10% of the viewport width, you should use the 'vw' (viewport width) unit. The 'vw' unit is based on the width of the viewport, making it ideal for responsive design. It ensures the box is always a percentage of the viewport's width, regardless of the screen size.
The ________ property in CSS specifies how overflows should be handled when the content overflows its block container.
- overflow
- overflow-type
- overflow-x
- overflow-y
The "overflow" property in CSS is used to specify how overflows should be handled when content overflows its block container. It can take values like "visible," "hidden," "scroll," and "auto" to control the display of content that overflows its container.
You're refactoring a website's CSS and want to separate styles that apply to layout from those that apply to modules. Which methodology would provide guidelines for this type of separation?
- ITCSS (Inverted Triangle CSS)
- ACSS (Atomic CSS)
- RSCSS (Reasonable System for CSS Stylesheet Structure)
- OOCSS (Object-Oriented CSS)
To separate styles that apply to layout from those that apply to modules, you should consider the ITCSS (Inverted Triangle CSS) methodology. ITCSS offers a scalable and logical structure for your stylesheets, with layers that guide you in distinguishing between core layout styles and module-specific styles, promoting maintainability and organization.
One of the benefits of CSS-in-JS solutions is that they can prevent unused styles, leading to ________.
- Enhanced SEO
- Improved performance
- Increased memory usage
- Reduced development time
CSS-in-JS solutions, such as styled-components or Emotion, can help prevent unused styles by generating scoped styles at runtime. This means only the styles required for a specific component are injected, leading to improved performance.
You're designing a button that, when clicked, shows a loading spinner. The spinner should rotate continuously. Which properties are crucial for this effect?
- animation-duration
animation-timing-function
animation-iteration-count
animation-direction - box-shadow
margin
border-radius
display - font-size
color
line-height
width - transform
transition
opacity
position
To create a loading spinner that rotates continuously, you need to use CSS animations. Key properties for this effect include animation-duration (to control the duration of the animation), animation-timing-function (to specify the timing function for animation), animation-iteration-count (to set it to 'infinite' for continuous rotation), and animation-direction (to make it rotate continuously using 'alternate' or 'normal').