Nav appears four times


#1

hey,why when there is unordered list within a <nav> tag. in the css file four nav selectors appears a nav selector, a nav ul selector, a nav li selector and finally a nav a selector.
thanks in advance,
Noob programmer.


#2

Please provide a link to the lesson…


#3

here it is:

https://www.codecademy.com/courses/make-a-website/lessons/boundaries-space/exercises/keep-inline?action=lesson_resume


#4

If you look at a HTML document
you must be aware that the HTML-document is loaded into your Browser
following the rules of the Document Object Model in short the DOM

If you look at this HTML document you could make a diagram (it really helps)

                     html
                      |
         +------------+-------------+
         |                          |
        head                       body
         |                          |
 +-----+-+--+----+    +---------+---+-----+
 |     |    |    |    |         |         |
title meta link link header    div       nav
                      |         |         |
                   +--+-+  (6X)figure     ul
                   |    |       |         |
                  h1    p      img   +--+-+-+-----+
                                     |  |   |     |         
                                    li li  li    div
                                     |  |   |     |
                                     a  a   a     a

figure header


#5

Thank you for answering my question but i still don’t really understand why there is four navs , im not understand what the a’s in the bottom of the diagram mean and to be honest i don’t understand how the DOM is related to my problem.


#6

In the CSS environment
you use

/*
comment out more then 1 line
*/

Test each the impact of each of the =selector=
by using the commenting in your CSS file
and then use RUN to see the impact of each of the =rules=

/*
nav {
  background-color: #FFF;
}
*/
/*
nav li {
  margin: 0;
  padding: 0 10px;
  display: inline;
}
*/
/*
nav ul {
  display: inline;
}
*/

=============================================
Use google search
to learn about the characteristics of each of the HTML Elements
like
a site:developer.mozilla.org
ul site:developer.mozilla.org
nav site:developer.mozilla.org


#7

I’m know what is anchor element unordered list element and navigator element. But just explain me why the nav appears four times. That is the only thing I wanna know!


#8

If you ask nav appaers 4 times
do yu mean in the display…
or
do you mean in the CSS file…


#9

I mean in the css file.


#10

i mean in the css file.


#11

Well did you test, as suggested in Nav appears four times
Look in the diagram presented to you in a separate post
1 to format the nav
1 to format the ul
1 to format the li
1 to format the div


#12

Thank you! Now I’m understand why there four navs there.


#13

Actually looking in the diagram
if they would have used
nav
ul
li
div
that would have had the same effect…as they are all unique

As long as it is clear to you
that the children / descendants inherit the CSS setting from the parent / ascendant


#14

Yes. Thank you again.


#15

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