Which of the following selectors matches an h1 heading with the id “topHeading”?
h1#topHeading
h1[id=“topHeading”]
h1
All of the above
The selectors with id can be used three ways
Example:
<h1 id ="idx"> Sample 1
</h1>
We can point to the head tag, by using h1#idx to
write css or directly calling with id tag as id will be always
unique, we can use id directly to specify its style like
#idx
In the above example,
We have specified h1[id="idx"] and set its color to red, then the h1 tag with id as "idx" changed its color to red, next style is with h1#idx it sets font style to italic, even that is reflected on output. But in third style, h1 tag is only present, then we have transformed the text to upper case. That is reflected on two h1 tags. So by this we can understand that by specifying id it can identify and change its properties, without specifying id and only tagname the properties of all tags present in that will be affected. from the above example C option may not only affect that id but also all the tagnames which are similar to that.
So, A, B are correct answers.
Get Answers For Free
Most questions answered within 1 hours.