Div&Id Problem


#1

Hi guys! I really have problem about Div and Id. I read at least 3 times but I do not get it well. Please, someone explain me clearly with basic words.

https://www.codecademy.com/courses/learn-html-css/lessons/ids-classes-divs/exercises/maintainable-code?action=lesson_resume



#2

Think of your school identification, or ID card. Yours is the only one. Everyone has a unique ID so their home room, classes, grades, teachers, counsellors and admin can identify each student, specifically.

In an HTML document (a web page or web app interface) ID's are treated the same way. There is only ever one element bearing any given ID attribute value.

<div></div>

Above is a DIVision element. We can have as many of these in our document as we need to wrap (contain) all the page content and navigation.

<div></div>
<div></div>
<div></div>
<div></div>
<div></div>

Since each will have a slightly different role, it is common to identify the key containers by their role.

<div id="header"></div>
<div id="navbar"></div>
<div id="content"></div>
<div id="footer"></div>

Each can be given a specific set of rules that apply to them and their children.

#header {

}
#navbar {

}
#content {

}
#footer {

}

See if you cannot apply this to your lesson.


#3

your narration could'nt have been clear. What you wrote is very useful. I noted all of them. Thanx a lot!
have a cod day :blush:


#4

i've been stuck on "learn html & css: part 1" for a long time. i am stuck in 10/12, instruction 2. it is about div as well.