HTML-CSS Créer une page d'hommage

Créer une page d’hommage User Story #1 Je ne comprend pas le id=“main”

Hi @Georges2 and welcome to the forum!!!

The HTML id attribute is used to specify a unique id for an HTML element.

You cannot have more than one element with the same id in an HTML document.

You just have to set the id of the main element to 'main' like this: <main id='main'>.

The <main> </main> surrounds the <head> </head>, <body> </body> and <footer> </footer> parts of the page.

When you give it an ID (like id=main) then you can use that ID in your CSS (styling). This would give the specified attributes to everything between <main> and </main> (beginning and end of the main part.

You can call it id=fish or id=funny if you like, but when you see ‘fish’ in your CSS, you might not guess that it is the name you gave to your <main> </main> part.
So, we call it id=main so that it is easier to figure out what you did when you look at your design in 6 months time to change something or do whatever is needed.

Le entoure les parties <head> </head>, <body> </body> et <footer> </footer> de la page.

Lorsque vous lui donnez un identifiant (comme id=main), vous pouvez utiliser cet identifiant dans votre CSS (style). Cela donnerait les attributs spécifiés à tout ce qui se trouve entre <main> et </main> (début et fin de la partie principale.

Vous pouvez l’appeler id=fish ou id=funny si vous le souhaitez, mais lorsque vous voyez ‘fish’ dans votre CSS, vous ne devinerez peut-être pas que c’est le nom que vous avez donné à votre partie <main> </main>.
Donc, nous l’appelons id=main afin qu’il soit plus facile de comprendre ce que vous avez fait lorsque vous regardez votre conception dans 6 mois pour changer quelque chose ou tout ce qui est nécessaire.

Je suis désolé. Je parle un peu français.
I checked the translation and I think it says what I was trying to say. Hope it helps.

Not to detract from @Georges2 topic but this information is incorrect.
Review this for an understanding of the HTML boilerplate tags.

True. In HTML, <main> </main> is actually a unique part, which should contain the Main idea of the page.
However, in the FCC challenges that I completed, the <main> </main> is used as an overall container.
They warn against using CSS on the <html> </html> (it could fail a test) [i.e. do not put \<html id=‘main’> and assign CSS attributes to #main in the Style part].
So for the purposes of this challenge, <main> </main> is effectively a ‘container’ for the other parts (<head> </head>, <body> </body> and <footer> </footer>).
That is why the challenge requires the <main id=‘main’>, which was the initial question.

Again, this is incorrect. That’s why I gave the link to the HTML boilerplate tags.

The main tags are rendered by the browser. Everything that is rendered by the browser goes between the body tags.
The head element is a collection of metadata for the document and does not belong in the body element…and therefore not in the main element either.

If you want to get into semantics, within the body element you’d have the main element and still within the body element you’d have the footer element though not necessarily in the main element.

As to the OP’s question, the user story says “…should have an element with a corresponding id="main", which contains all other elements
That can be either;
<div id="main"> </div>
<main id="main"> </main>

If you’re still unsure or have questions about it please open a new topic to discuss rather than detracting from the OP’s topic.

Compris merci beaucoup

1 Like

Compris Mr merci beaucoup

1 Like

Oft depuis je tente de t’envoyer un merci mais cela m’ecrit un message de vide je ne comprend pas mais merci

De Rien.
J’apprends le français, donc je parle un peu.

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