Which code snippet will select all <img> tags on a page and set their height to 200 pixels?

Study for the CodeHS Web Design (Picasso) Test. Prepare with flashcards and interactive multiple choice questions, each question supported by hints and explanations. Ace your exam!

The code snippet that selects all <img> tags on a page and sets their height to 200 pixels is valid because it uses the correct CSS syntax for selecting elements and applying styles. In CSS, to target specific HTML elements, you write the element name (in this case, img) followed by a set of curly braces containing the styles you want to apply.

The declaration height: 200px; specifies that the height of all <img> elements should be set to 200 pixels, using the proper unit of measurement (pixels) indicated by "px." This is the standard format for defining styles in CSS, making this choice effective and appropriate for styling.

Other options provided contain syntax issues or incorrect selectors that prevent them from functioning as intended. For instance, simply writing height: 200; lacks the necessary unit (like pixels), which is crucial for proper interpretation by browsers. Similarly, using <img> within a style block is incorrect syntax for CSS, as it should only contain selectors, not HTML tags. Lastly, adding "All" before img is not a recognized way to specify the element in CSS, making that option invalid as well.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy