The capital letter Q, resembling a magnifying glass, inside a circle.

Example quiz: CSS

Back to examples

Generated question

What are CSS media queries and how are they used to create responsive web designs?

Entered response

Generated feedback


  • The answer correctly identifies that CSS media queries are used to set different CSS styles for different screen widths.
  • It mentions that responsive designs change the CSS for optimal layout at different widths.


  • The answer could be improved by mentioning that media queries are written using the @media rule in CSS.
  • The answer could also be improved by mentioning that media queries can be used to target other media features like height, orientation, and resolution, not just screen width.
  • The answer could provide an example of a media query and how it is written in CSS.

Example answer

CSS media queries are a feature in CSS that allow developers to apply different styles to elements based on various media features, such as screen width, height, orientation, and resolution. Media queries are written using the @media rule in CSS.

By using media queries, developers can create responsive web designs that adapt and change their layout and styles based on the characteristics of the device or screen being used. This ensures that the website or application looks and functions optimally on different devices, from large desktop screens to small mobile phones.

For example, a media query can be used to change the font size, layout, or positioning of elements when the screen width is below a certain threshold. This allows for a more user-friendly and visually appealing experience across different devices and screen sizes.