Main element and advs

Greetings, this is my first post, I recently found this forum and so far is looking good, :slight_smile:.

Anyways, I’m learning HTML5 at the moment and I have a little question about the main element, precisely when nesting advs on it.

I read the main specs and there’s a part that says:

The main content area of a document includes content that is unique to that document and excludes content that is repeated across a set of documents such as site navigation links, copyright information, site logos and banners and search forms (unless the document or applications main function is that of a search form).

Source: Main element specs.

My question here is, if I need to put an advertise that it’s repeat site-wide, is it semantically wrong? After all, that content would be repeated and the main element kinda prohibit that…

Thanks in advance, regards Wult.

PS: Sorry if I wrote anything wrong here, my mother tongue isn’t English.

When it says “unique to that document” it refers to a single page on a site. So there should be only one <main> on any one page. But each page on the site can have its own main.

That element is specifically for the main content of the page, it would generally not be used for an advertisement, unless the page is nothing more than just the advertisement.

Thanks for reply.

Well I think I already know that, correct me if I’m wrong, what I understand is (in simple words) that everything inside the main element it’s about the central topic of a page, and it cannot be a descendent of a structural element, that’s all right.

But in the “unique” part I’m a little confused in that if an adv, that is repeat it in the site, with no relatitionship with the central topic, could be repeat it without breakind the rules. Because if it’s repeat it, wouldn’t stop being unique to a page?

I don’t know if I’m explaining myself… :confused:

Yes, I know, the adv it’s supposed to be, well, an adv, no the whole thing. It’s not for the adv itself, it’s in case that I need put an adv alongside with the whole content.

The spec you quote suggests that your ad should not be within the main element, but placed in another container outside of the main.

Maybe looking for <aside> ?

https://www.w3.org/TR/html5/sections.html#the-aside-element

The element can be used for typographical effects like pull quotes or sidebars, for advertising, …

1 Like

Thanks for reply.

Well, I’m thinking in put the adv inside an aside, but isn’t kinda the same?

I mean, that aside will eventually repeat itself with the same content, the adv in this case…

:confused:

But the rules about uniqueness do not apply to aside, like they do with main.

1 Like

Oh really? I didn’t know that.

Well, if there isn’t any problem, I think I’ll do it that way.

Thanks.

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