Which pseudo-class would you use to target an element when it's being hovered over by a mouse pointer?
- :active
- :focus
- :hover
- :visited
The :hover pseudo-class is used to target an element when it's being hovered over by a mouse pointer. This is commonly used to apply styles or behaviors to elements when a user hovers their cursor over them. For example, you can change the background color of a button when it's hovered over to provide feedback to the user.
In SASS/SCSS, what is the primary difference between a mixin and a function?
- Functions are used for reusable styles, while mixins are for reusable logic
- Functions can be called multiple times within a rule, but mixins cannot
- Mixins can accept arguments, but functions cannot
- Mixins can produce CSS rules, but functions cannot
The primary difference between a mixin and a function in SASS/SCSS is that functions are used for reusable styles and can return values, while mixins are used for reusable logic and can generate CSS rules. Mixins can accept arguments, which allows for more dynamic behavior, whereas functions are typically used for calculations and value generation.
What is the primary goal of the OOCSS (Object-Oriented CSS) methodology?
- To apply styles globally
- To eliminate the need for HTML
- To make CSS more complex
- To separate content and layout
The primary goal of the OOCSS (Object-Oriented CSS) methodology is to separate content and layout. OOCSS promotes creating reusable and modular CSS classes that can be applied to various elements in a layout, separating the styling from the content. This improves maintainability and promotes a more organized CSS structure.
Which of the following CSS combinators targets a direct child element?
- *
- +
- >
- ~
The ">" combinator is used to target a direct child element, ensuring that styles are applied only to the immediate child and not to nested descendants.