HTML5 Semantic Elements Nesting with Boostrap - html

I have an article template in which I want the title to run the full width of the page (12 cols), and then the text itself to fall in below with an adjacent sidebar (8 and 4 cols respectively). The problem is that I can't get the sidebar to nest alongside the article body without placing it within the article section.
My question is: is it bad practice to move the sidebar element up so it falls within the article section, and thus sits nicely on the right next to the main content, but below the title?
The markup would look something like this:
<article>
<header>
PAGE/POST TITLE
</header>
PAGE/POST CONTENT
<div class="sidebar">
SIDEBAR CONTENT
</div>
</article>

The article element, just like any other HTML element, should only contain content that conforms to the element’s definition.
Including navigation doesn’t seem to be appropriate, unless it’s the navigation for the article itself (like a table of contents or similar), in which case you should use the nav element.
While there is the aside element, which would allow to markup separate content inside of article, this content still has to be
[…] tangentially related to the content around the aside element

Related

Is it valid to use multiple footer (or header) elements as adjacent siblings?

I am working with an eBook. For the Copyright page, the Details page containing general information about the book and other publication notes I am using the footer element.
Now, I have two basic options. One of them is using a single footer element containing multiple section elements to accommodate all of the pages (4 in total). The other option is to have multiple footer elements, each containing the specific pages.
The first option (only one footer with multiple section) seems better to me, except that when I validate the HTML, it says that I need to have heading (h1, h2, etc.) for each of the section elements. The problem with this is that I do not want to have to use headings for these secondary sections, since they are not as important as the main content of the book and yet, these headings will be prominent and be placed on top of the page outline, making them appear more important than they are.
Can I have multiple footer elements that are adjacent siblings from each other? Is this semantically valid?
The other question/answer that I could find related to this one was html5: using header or footer tag twice?, but it just discusses the use of multiple footer within a page, but not necessarily having them next to each other as adjacent siblings (multiple footer for the same section).
The HTML5 standard specifies that nested footer elements are not permitted. Adjacent would not be nested though. Adjacent would mean multiple footer elements for a single parent element, or side-by-side footers which seems sloppy. See MDN.
It really boils down to keeping it simple. Ask yourself, what is the use case for adjacent or side-by-side, or double, footer elements?

header, footer or main element inside dialog element in html5

Is semantically correct to use a header, footer o main elements inside a dialog component in Html5?.
I want to build a complex modal view with options about articles in my main page content. I am wondering if is correct use html5 as follows
<dialog>
<header>
<h1>Title</h1>
<button> Save </button>
</header>
<main>
<!--modal view options-->
</main>
</dialog>
Only the <main> tag shouldn't be there.
As copied from W3schools:
The header element represents a container for introductory content or a set of navigational links.
And:
You can have several header elements in one document.
This applies to the header and the footer.
but then there is this:
There must not be more than one main element in a document. The main element must NOT be a descendant of an article, aside, footer, header, or nav element.
So, to say it in a short way:
you can use multiple <header> and <footer> tags in your document, but you're better of using a <div> instead of your <main>
Tl;dr
Using header, footer or main in the dialog element for the purpose of describing this dialog's content is not semantically correct.
About header and footer
Only Sectioning content elements (or body) define a semantic scope that is applied to header and footer. dialog is not a sectioning content (source). So, header and footer placed within dialog will describe the closest sectioning content or body, not a dialog itself.
About main element
There are 3 important rules to remember when using main element (source):
it should be used only to represent the dominant contents of the document (dialog's content is not likely to be the dominant content),
there can be only one main element without hidden attribute on the webpage at the same time (which means you would need to add hidden attribute on your general main page element),
main element ancestors can only be html, body, div or form elements without an accessible name. main cannot be contained within anything else, including autonomous custom elements.
So, 3rd point makes it impossible to use main element inside of a dialog. And 1st and 2nd make it really hard.
Solution
Good solution in this case would be to either drop using of those elements or to wrap dialog's content with a section element to be able to provide semantic header and footer.
<dialog>
<section>
<header><!-- header content --></header>
<div>
<!-- modal content -->
</div>
<footer><!-- footer content --></footer>
</section>
</dialog>

HTML 5 are the new tags header/nav/aside/section etc containers like div?

As the title says, do I have to use these new tags in a DIV or are they basically DIVs themselves?
This is how each of the major HTML5 tags can/should be used:
section – Used for grouping together thematically-related content. Sounds like a div element, but it’s not. The div has no semantic meaning. Before replacing all your div’s with section elements, always ask yourself: “Is all of the content related?”
aside – Used for tangentially related content. Just because some content appears to the left or right of the main content isn’t enough reason to use the aside element. Ask yourself if the content within the aside can be removed without reducing the meaning of the main content. Pullquotes are an example of tangentially related content.
header – There is a crucial difference between the header element and the general accepted usage of header (or masthead). There’s usually only one header or ‘masthead’ in a page. In HTML5 you can have as many as you want. The spec defines it as “a group of introductory or navigational aids”. You can use a header in any section on your site. In fact, you probably should use a header within most of your sections. The spec describes the section element as “a thematic grouping of content, typically with a heading.”
nav – Intended for major navigation information. A group of links grouped together isn’t enough reason to use the nav element. Site-wide navigation, on the other hand belongs in a nav element.
footer – Sounds like its a description of the position, but its not. Footer elements contain informations about its containing element: who wrote it, copyright, links to related content, etc. Whereas we usually have one footer for an entire document, HTML5 allows us to also have footer within sections.
<header>
The <header> element represents a container for introductory content or a set of navigational links.
A element typically contains:
one or more heading elements ( - ) logo or icon authorship information You can have several elements in one document.
Note: A <header> tag cannot be placed within a , or another element.
<nav>
The <nav> tag defines a set of navigation links.
Notice that NOT all links of a document should be inside a <nav> element. The <nav> element is intended only for major block of navigation links.
<aside>
The <aside> tag defines some content aside from the content it is placed in.
The aside content should be related to the surrounding content.
<section>
The <section> tag defines sections in a document, such as chapters, headers, footers, or any other sections of the document.

Which html5 element for centered viewport

I want to make use of the semantics of the html grouping elements as much as possible.
I am struggling with the right element name for a viewport that centers my whole page in the middle of the screen (only horizontally).
My current solution is this:
<section id="viewport">
<header>
<nav>
<ul>
<li id="home">Home</li>
<li id="about">About me</li>
<li id="contact">Contact</li>
</ul>
</nav>
</header>
<main data-ng-controller="shell as vm">
<img alt="logo" src="/content/images/midbody.png" />
<aside data-ng-show="vm.isBusy" class="page-splash dissolve-animation">
<div data-cc-spinner="vm.spinnerOptions"></div>
</aside>
<article data-ng-view class="contentpage"></article>
</main>
<footer>
<div id="footer">Webdesign by Patrick Peters</div>
</footer>
</section>
The html elements are about semantic. While footer, header or aside imply somehow that header is at the beginning footer at the end and aside somewhere else, they main purpose is not about telling how their layout is, but to describe the importance and what they are about.
Because of that there is no equivalent for a centered element, because centered is only a visual information. And the visual representation belongs to css.
So if section fits use section. You have a header and a footer so it is a section somehow, but as it is the whole page that is represented by body there is no real need to wrap it into a section (it does not make the structuring clearer). If it has no semantic meaning you can stay with div as an anonymous container.
whatwg: section
The section element represents a generic section of a document or application. A section, in this context, is a thematic grouping of content, typically with a heading.
Examples of sections would be chapters, the various tabbed pages in a tabbed dialog box, or the numbered sections of a thesis. A Web site's home page could be split into sections for an introduction, news items, and contact information.
Note: The section element is not a generic container element. When an element is needed only for styling purposes or as a convenience for scripting, authors are encouraged to use the div element instead. A general rule is that the section element is appropriate only if the element's contents would be listed explicitly in the document's outline.
whatwg: body
The body element represents the main content of the document.

Is it good to design a web page, using tags other than DIV?

Is it good to design a web page, using tags other than DIV's?
And, in case there are such tags worth its use, please let me know their advantage or disadvantage.
div tags are container tags. Putting content into a container tag allows you to do the following:
Use margins or padding to tweak the position of the contained content
Put a border around the contained content
Position the contained content with float, absolute or relative positioning
Hide/show a group of content all at once by hiding/showing the div
Assign a class or id to the div and apply CSS rules to everything in the contained content
Apply a common background to the contained content
You need only as many divs as are required to achieve your layout or achieve any future flexibility in styling that you want. More divs beyond that doesn't do anything for you.
<div> tags are really only for miscellaneous blocks. For better functionality, use the HTML5 tags <article>, <section>, <header>, <footer>, <aside>, and <nav> where appropriate. See the HTML specs (draft) for more information.
Tables are great to display specific data, for example results from experiment. Divs should be used to build whole layout of your website.
It's not a question to have more or less div tags. You have to use the amount of div you really need. It's true that nowadays div tags are more used than table also because they makes your code cleaner but again isn't a quantity problem.
DIVs yes, as Aurelio said, it really depends on your design/build on how many you use. Don't do things like put text inside a DIV e.g. <div class="title">text here</div>. Put them into <h1 class="title">text here</h1>, or, <p class="txt">txt here</p> etc
Don't build your website using tables for its structure, or use inline styles on your DIVs e.g. <div style="color:#ccc; font-size: 12px;">text here</p>.