Which CSS code applies a grayscale filter to all images?

Prepare for your CodeHS Web Design (Picasso) Test with quizzes and multiple-choice questions designed to enhance your understanding. Gain confidence with hints and explanations for each question to excel in your exam!

Multiple Choice

Which CSS code applies a grayscale filter to all images?

Explanation:
The code that applies a grayscale filter to all images is correct because the `filter` property in CSS allows you to manipulate the rendering of images and other elements. The `grayscale()` function specifically converts the colors of an image to shades of gray. When you use `grayscale(100%)`, it applies a full grayscale effect, resulting in the image displaying only in black and white, with no color information left. The other options utilize different filter functions that do not result in a grayscale effect. The `brightness()` filter adjusts the lightness of the image, `contrast()` modifies the difference between the lightest and darkest parts, and `sepia()` gives a brownish tone to the image, all of which are distinct from transforming an image into grayscale.

The code that applies a grayscale filter to all images is correct because the filter property in CSS allows you to manipulate the rendering of images and other elements. The grayscale() function specifically converts the colors of an image to shades of gray. When you use grayscale(100%), it applies a full grayscale effect, resulting in the image displaying only in black and white, with no color information left.

The other options utilize different filter functions that do not result in a grayscale effect. The brightness() filter adjusts the lightness of the image, contrast() modifies the difference between the lightest and darkest parts, and sepia() gives a brownish tone to the image, all of which are distinct from transforming an image into grayscale.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy