What is the difference between `@media` and `@supports` in CSS?

Prepare for the CodeHS Advanced HTML and CSS Test. Leverage comprehensive questions with detailed explanations and hints. Ace your exam with tailored practice!

The choice highlighting that @media applies styles based on media conditions is correct because @media is a CSS at-rule used to apply different styles depending on the media type or device characteristics. This includes features like screen resolution, viewport width, or device orientation. For instance, a developer might use @media to create responsive designs that adjust layouts or styles for mobile devices versus desktop displays, ensuring an optimal user experience across various devices.

The other options present misconceptions: @supports is not deprecated; it is an important tool for feature queries in CSS that checks if a particular style feature is supported by the browser. Furthermore, @supports is not limited to media queries; it is specifically designed to determine the browser's support for CSS properties, enabling developers to apply styles conditionally based on the capabilities of the user's browser. Lastly, @media does not check for property support; its primary function is to assess the environment in which the CSS is being rendered.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy