Understanding Media Queries
Which of the following best describes what a CSS media query is used for in web design?
- A. Applying styles based on device characteristics like screen size and orientation.
- B. Creating animations for user interactions.
- C. Storing user data across web pages.
- D. Embedding fonts from external sources.
- E. Increasing website loading speed directly.
Media Types
In the media query '@media print { ... }', what does the 'print' part specify?
- A. The query runs only for printed documents.
- B. The code will create a pop-up message.
- C. The style applies to mobile devices only.
- D. It indicates the text should be bold.
- E. It restricts styles to portrait orientation.
Common Media Features
Which of the following is a valid media feature you can target in a media query for responsive design?
- A. max-width
- B. font-family
- C. text-align
- D. hover-color
- E. data-src
Combining Media Features
How do you combine multiple conditions, such as screen width and orientation, in a single media query?
- A. By using the 'and' keyword between features.
- B. By separating conditions with a semicolon (;).
- C. By placing both conditions within parentheses without any keyword.
- D. By writing each condition in a separate media query.
- E. By using the 'with' keyword.
Logical Operators
Which operator allows you to write a media query that only applies if the condition is NOT met?
- A. not
- B. on
- C. in
- D. skip
- E. nor
Breakpoints in Responsive Design
What are 'breakpoints' in the context of CSS media queries?
- A. Specific screen widths where the layout should change.
- B. The points where a browser starts to lag.
- C. The maximum number of styles allowed.
- D. Predefined font sizes for mobile devices.
- E. Dividers for separating HTML elements.
Placing Media Queries
If you want to change the style of a '.container' class only for screens smaller than 600px, what is the correct way to nest the CSS?
- A. Place the rules for '.container' inside a '@media (max-width: 600px)' block.
- B. Put the '@media' rule inside the '.container' selector.
- C. Use 'container: (max-width: 600px) { ... }' directly.
- D. Only add 'max-width' to the '.container' class and it will work automatically.
- E. Use '!important' after every style property.
Best Practices
Which is considered a good practice when writing media queries for responsive design?
- A. Use 'max-width' for breakpoints and follow a mobile-first approach.
- B. Always use fixed pixel values for all elements.
- C. Avoid testing your design on different devices.
- D. Only focus on desktop layouts.
- E. Write overlapping queries for each device brand.
Media Queries vs Responsive Images
What is a main difference between CSS media queries and responsive images?
- A. Media queries change CSS styles, while responsive images load images based on device conditions.
- B. Media queries work only with photos, not layout.
- C. Responsive images only affect fonts, not visuals.
- D. Both must always be used together.
- E. Media queries require JavaScript, responsive images do not.
Media Queries vs Frameworks
How do custom media queries differ from using predefined CSS framework classes for responsiveness?
- A. Media queries offer more precise control, while frameworks use preset classes.
- B. Frameworks allow unlimited customization, media queries do not.
- C. Both approaches produce identical code with same results automatically.
- D. Framework classes require no CSS knowledge at all.
- E. Custom media queries are only for print layouts.