Website Developer Question:

Download Job Interview Questions and Answers PDF

Tell me what Is An ID Selector?

Website Developer Interview Question
Website Developer Interview Question

Answer:

The ID selector uses the “ID” attribute of the target HTML element to select it. The constraint to work is that the ID should be unique within a page so that the selector can point it out correctly.

To build an ID selector expression, start with a hash (#) character, followed by the id of the element.

Here is an example which selects a paragraph element using its ID.

#sample {padding: 10px;}

<p id="selector">...</p>

Download Website Developer Interview Questions And Answers PDF

Previous QuestionNext Question
Tell us how can you refer to CSS file in the web page?Tell me what Are Pseudo-Classes In CSS?