Practice
1. Why is responsive design important for websites?
Responsive design means:easy
Solution
Step 1: Understand responsive design purpose
Responsive design means the website changes layout to fit screens of all sizes.Step 2: Compare options with definition
Only "The website adjusts its layout to fit different screen sizes." describes adjusting layout for different screen sizes, matching responsive design.Final Answer:
The website adjusts its layout to fit different screen sizes. -> Option BQuick Check:
Responsive design = layout adjusts to screen size [OK]
Hint: Responsive means adapting layout to screen size [OK]
Common Mistakes:
- Thinking responsive means fixed size
- Assuming it works only on desktop
- Ignoring mobile users
2. Which CSS technique is commonly used in responsive design to adjust layouts?
Choose the correct syntax example:
Choose the correct syntax example:
easy
Solution
Step 1: Identify correct media query syntax
CSS media queries use@media (condition) { rules }to apply styles based on screen size.Step 2: Check options for valid syntax
@media (max-width: 600px) { body { font-size: 1.2rem; } } uses correct@mediasyntax; others are invalid CSS.Final Answer:
@media (max-width: 600px) { body { font-size: 1.2rem; } } -> Option AQuick Check:
Media queries use @media (condition) [OK]
Hint: Look for '@media' keyword for responsive CSS [OK]
Common Mistakes:
- Using invalid CSS like '@screen'
- Adding 'fixed' keyword incorrectly
- Confusing px with rem units
3. Given this CSS snippet:
What happens when the screen width is 480px?
@media (max-width: 500px) { .menu { display: none; } }What happens when the screen width is 480px?
medium
Solution
Step 1: Understand media query condition
The rule applies when screen width is 500px or less.Step 2: Apply condition to 480px screen
Since 480px is less than 500px, the CSS inside applies, hiding the menu.Final Answer:
The menu is hidden from view. -> Option CQuick Check:
Screen ≤ 500px hides menu [OK]
Hint: Check if screen size meets media query condition [OK]
Common Mistakes:
- Ignoring media query conditions
- Assuming menu changes color without code
- Thinking menu moves without position rules
4. This CSS code is meant to hide an image on small screens but it doesn't work:
What is the error?
@media max-width: 400px { img { display: none; } }What is the error?
medium
Solution
Step 1: Check media query syntax
Media queries require parentheses around conditions, like@media (max-width: 400px).Step 2: Identify missing parentheses
The code misses parentheses, so CSS is invalid and ignored.Final Answer:
Missing parentheses around max-width condition. -> Option DQuick Check:
Media queries need parentheses [OK]
Hint: Always wrap media conditions in parentheses [OK]
Common Mistakes:
- Omitting parentheses in @media
- Using wrong selectors
- Thinking display:none is invalid
5. You want a button in Figma to look good on phones and desktops. Which approach best uses responsive design principles?
hard
Solution
Step 1: Understand responsive design in Figma
Responsive design uses flexible sizes and constraints to adapt elements to screen sizes.Step 2: Evaluate options for best practice
"Use flexible width and height with constraints, plus test on different screen sizes." uses flexible sizing and testing, matching responsive design principles.Final Answer:
Use flexible width and height with constraints, plus test on different screen sizes. -> Option AQuick Check:
Flexible constraints + testing = responsive design [OK]
Hint: Use flexible constraints and test on devices [OK]
Common Mistakes:
- Using fixed sizes only
- Designing for one device only
- Ignoring testing on multiple screens
