Revature Practice Test 2025 – Complete Exam Prep Guide

Question: 1 / 400

In CSS, how do you select an element with the id "header"?

.header

#header

To select an HTML element with a specific id in CSS, you use the '#' symbol followed by the id name. The syntax for selecting an element with the id "header" is therefore written as #header. This tells the browser to apply the specified styles to the element that has an id attribute of "header."

Using a period (.) before a name would indicate a class selector, which is different from an id selector. The absence of any selector symbol would imply that you're targeting an element type (like a <header> tag, if it exists), while the asterisk (*) is a universal selector that targets all elements, which wouldn’t narrow down to just the one with the specific id. Thus, the correct method to target an element by its id is to use the syntax that starts with #.

Get further explanation with Examzify DeepDiveBeta

header

*header

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy