You're tasked with creating a responsive website that adapts to different screen sizes. How would you use CSS media queries to achieve this?

  • Apply inline styles to elements based on screen size.
  • Define breakpoints for various screen sizes and apply specific styles using media queries.
  • Use JavaScript to detect screen sizes and apply different CSS styles accordingly.
  • Use a CSS framework to handle responsive design automatically.
CSS media queries are used to apply different CSS styles based on the characteristics of the device or browser, such as screen width, height, orientation, etc. The correct approach is to define breakpoints where the layout needs to change, such as for small, medium, and large screens. By applying specific styles using media queries for each breakpoint, you ensure that the website adapts appropriately to different screen sizes, providing an optimal user experience across devices.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *