CSS MCQs

21 MCQs  — Web Development MCQs  (Page 2 of 3)

In mobile-first responsive CSS, which media queries are typically used?
No media queries
min-width queries that add styles as the screen gets wider
max-width queries only
orientation queries only
What does the selector div > p select?
<p> elements that are direct children of a <div>
All <p> elements anywhere inside a <div>
Every <p> that follows a <div>
A <p> immediately after a <div>
What is the difference between :hover and ::before?
:hover is a pseudo-class (a state); ::before is a pseudo-element (generated content)
Both are pseudo-elements
Both are pseudo-classes
::before is a state
Two rules with identical specificity set different colors on the same element. Which one applies?
The darker color
The rule that appears later in the cascade (source order)
Neither; it is an error
The first rule
What does 100vh mean?
100% of the viewport's height
The height of 100 lines
100% of the parent's height
100 virtual pixels
What is the difference between a CSS transition and a CSS animation?
They are identical
Transitions use @keyframes
Animations require JavaScript
A transition animates between two states when a property changes; an animation runs keyframes that can loop without any trigger
What are SASS and LESS?
Browser engines
CSS validators
JavaScript frameworks
CSS preprocessors that add variables, nesting, and mixins, and compile to plain CSS
What does position: sticky do?
It is the same as fixed
It works only on images
The element acts as relatively positioned until a scroll threshold is reached, then sticks like a fixed element within its container
It removes the element from the flow