M
M
MyQuestion2021-04-01 18:24:18
HTML
MyQuestion, 2021-04-01 18:24:18

What should be in the nav tag?

Good afternoon!

The question is of course simple, but with some uncertainty...

What should be in the nav tag ? Apart from the menu. Shopping cart, personal account, search? Or is it a matter of taste?

I also want to ask about the name, here I am also confused... What do you usually call these blocks? By simple type main-nav__left (menu) and main-nav__right (basket, personal account, search, etc.). Or in some other way?

This also leads me to the next question. If it's not part of the nav tag , or is it part of it, can elements like search or personal area be named as separate blocks? From a BEM perspective, are they a block or an element? And an element of what? Header or navigation...

And in relation to the header, can we assume that, in principle, most of the tags inside it are blocks, but not elements? After all, they can be reused on the page without being tied to a header.

This whole chain of questions arose because of the potentially colossal nesting of names - main-header , main-nav , user-nav or user-controls , as well as basket (and here, the section name looks lonely) or search .

And a bonus question, which probably should have been taken out as a separate topic, but still:
Is the image in the slider a content image? As a rule, the image in the slider carries useful information, and if the styles are not connected, the user should see these slides, right? How do you usually add an image to a slider via html or css using background-image ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan V, 2021-04-01
@verkhoturov

What should be in the nav tag?

The nav tag should contain navigation (links).
What do you usually call these blocks? By simple type main-nav__left (menu) and main-nav__right (basket, personal account, search, etc.). Or in some other way?

From the name of the element, it should be clear what kind of element it is, and not its property.
(good: nav__basket, nav__link, nav__search, bad: nav__top, nav__last, nav__blue)
If it's not part of the nav tag, or is it part of it, can elements like search or personal area be named as separate blocks?

Blocks can be nested in Blocks , that's fine.
And in relation to the header, can we assume that, in principle, most of the tags inside it are blocks, but not elements? After all, they can be reused on the page without being tied to a header.

If something can be reused in another part of the page, it's a Block . If the meaning is lost out of context, this is an Element .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question