Text content tags


#1

I don’t understand what purpose does the id serve for the div and what can the id can be used for?

Example:
div id="habitat"
h2>Habitat</h2
h3>Countries with Large Brown Bear Populations</h3
h3>Countries with Small Brown Bear Populations</h3
p> Some countries with smaller brown bear populations include Armenia, Belarus, Bulgaria, China, Finland, France, Greece, India, Japan, Nepal, Poland, Romania, Slovenia, Turkmenistan, and Uzbekistan. </p
</div


#2

well, if we have multiple div elements on our page, and we want to apply a background-color, we could do:

div {
    background-color: red;
}

but this would make all divs red, if we just want habitat to be red, we could do:

#habitat {
    background-color: red;
}

this is just one of the possibilities, you will learn more if you continue the course.

it can happen that concepts are introduced which are not immediate clear, just continue the course, and you will see them being used


#3

Thank you very much :smile:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.