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.
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.
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.
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.
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.
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.
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.
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.
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.
In a responsive design, the term ______ is used to describe a layout that adjusts and looks good on all screen sizes.
- adaptive
- dynamic
- fixed
- fluid
In responsive design, the term "adaptive" describes a layout that adjusts and looks good on all screen sizes and devices. An adaptive design ensures that the content and layout respond effectively to various screen sizes, providing a seamless user experience.