DIV vs. NAV tag with CSS positioning

Quick question - I hope a simple answer.

I know that a tag <nav>is a block level element. Now I know that everything that you put inside this tag can also be placed inside <div>in terms of content and style.

Now, when I set the position of this element to fixed ( position: fixed), it works when I use <div>with a tag id, but not when I do it inside <nav>.

While I use a single tag <nav>, could I just create it using the nav { style here }correct one? I do not have to use id for this.

However, the position style does not work with <nav>.

Is there a reason for this, or should I always use ideven with <nav>??

EDIT

Sorry to forget to mention my user information. I use chrome 34 and I know the difference between classes and identifiers, but I saw stylesheets and tutorials to double check where they did what I described. That is why I am confused.

I assume the question will be: "Why do some css styles work in the div tag and not in the nav tag?" I thought it was just a semantic difference, it’s easy to say where the navigation structure is.

-1
source share
3 answers

While I am using a single tag, I could just create it using nav {style here} correctly? I do not have to use id for this.

!
. , css nav , nav. .

, CSS, "" * > . , > *, .

<nav>. , id <nav>??

, . ID . html selction.

CSS Specificity in 4 columns:
inline=1|0|0|0, id=0|1|0|0, class=0|0|1|0, element=0|0|0|1
Left to right, highest number takes priority.

 0,1,0,0 > 0,0,10,10

1. inline
2. num of #ID
3. num of .class
4. hum of html element selectors

0. JavaScript (dom inline + last = strongest selection)

.

position: fixed !important;
, !important; . , .

+2

<nav> - HTML (5) -tag, . , ( ).

Chrome :

user agent stylesheet for nav

, CSS, , div, CSS:

enter image description here

Chrome 34.

, , css. display: block;.

0

, , , .

id = . .

class= . . .

0

All Articles