b2evolution b2evolution

  • Sign in
  • Sign up
  • About
  • Downloads
  • Hosting
  • Docs
  • Support
  • Sign in
  • Sign up
  • Manuals Home
  • Latest Updates
 
  1. b2evolution CMS User Manual
  2. Developer Reference
  3. Website Skins/Themes
  4. Using HTML 5 tags

Using HTML 5 tags

Using HTML 5 tags
A high-level view. More semantic tags when you dig down into <main>...

b2evolution 6.4.1 uses HTML 5 semantic tags in the Skin API v6 by default.

This page explains how the tags are used on b2evolution skins v6.

IMPORTANT: these tags are for semantic markup. Imagine you are blind and you listen to an audio screen-reader. These tags tell the screenreader how to jump to the main content, to the articles, to the navigation… and how to NOT read the NOT important things like <footer> or <aside> until we say we explicitly want to read these.

IMPORTANT: These tag names should ideally NOT appear in CSS files. Use CSS classes whenever possible. Keep in mind most tags like <article>, <header>, <nav> can appear multiple times on a page and be nested several times! <footer> does NOT mean "the" footer. It means "a" footer.

An example

The screenshot above shows a view from an HTML code inspector with only a few levels expanded. (Look at the "Bootstrap Blog" skin if you want to reproduce this).

As you can see, the use of the HTML 5 sectioning elements allows to quickly grasp the structure of the page and the comments showing the start of the Main area and the start of the sidebar become almost unnecessary.

A few notes about this example:

  • We deliberately chose to use tags like <header> or <nav> on the highest possible level, instead of hiding them in extra <div><div><div> which would also be semantically correct but would make the tags less useful when exploring the code of the page as shown above.
  • Note there are 2 footer elements. This is normal and conforms to the HTML 5 spec. This means that when you design your CSS, it’s a bad idea to consider <footer> or any other HTML5 semantic tag, to be unique.
  • We chose to add a standalone <main> instead of optimizing as <main class="col-md-9"> one level higher because <main> is not supported by Internet Explorer.

Detail of sectioning tags

<nav>

Used to wrap navigation sections. All navigation does not necessarily need to be marked with <nav> tags but all the main navigation definitely must! For example, footer navigation may be not marked with <nav>.

The container "Menu" is definitely enclosed in a <nav>.

<article>

Used to wrap posts but also comments. Comments are generally marked as sub-articles of a post.

However, on disp=comments which displays the latest comments without posts, comments are standalone articles.

<header>

Used for the body header. It encompasses the containers "Header" and "Page Top".

Also used inside <article>.

<footer>

Used for the body header. It encompasses the container "Footer".

Also used inside <article>.

<figure>

All images attached to Posts and Comments (which are <article>s) are wrapped in <figure>.

<figcaption>

When a figure has a caption, it is always wrapped in <figcaption>.

<aside>

Used for the sidebar in skins that have one, or for other areas containing widgets that are not the main content. There may be several <aside> sections on a page. They encompass the containers "Sidebar" and "Sidebar 2".

(Not used inside <article> at this time but could be used in the future, especially for pull-out excerpts).

<section>

Used to mark up logical sections of an <article> (or another element like <aside>).

In an <article> for example, there is one <section> for the main content and another <section> for the comments.

Other HTML 5 semantic tags

<main>

This is NOT a sectioning element. It is merely a hint for screen readers.

This tag is also unsupported by Internet Explorer, even in 2015.

Therefore we add this tag (without any CSS class because it’s not fully supported) but we pretend it’s not there as far as CSS and JS are concerned.

Future developments

We are evaluating the use of <address>.

Some useful resources:

  • http://www.w3.org/TR/2013/CR-html5-20130806/sections.html#the-article-element
  • http://www.w3.org/TR/html-markup/elements.html#elements
  • http://diveintohtml5.info/semantics.html
  • http://blog.teamtreehouse.com/use-html5-sectioning-elements

Please comment below for any additional suggestions.

Created by fplanque • Last edit by fplanque on 2020-06-09 00:25 • •

No feedback yet

On this page

  • An example
  • Detail of sectioning tags
  • <nav>
  • <article>
  • <header>
  • <footer>
  • <figure>
  • <figcaption>
  • <aside>
  • <section>
  • Other HTML 5 semantic tags
  • <main>
  • Future developments

Search the Manual

Content Hierarchy

  • b2evolution CMS User Manual
  • User's Guide
  • Installation / Upgrade
  • Front-office Reference
  • Back-office Reference
  • Developer Reference
    • Website Skins/Themes
      • Skin Development Primer
      • Loading additional resources into a skin
      • Where are the skin files?
      • CSS Guidelines
      • Targeted CSS Selectors
      • Introducing evoSkins
      • Modifying evoSkins
      • Creating evoSkins
      • Skin Tags / API
      • Styling widgets
      • Skin Quality Control
      • Using HTML 5 tags
      • Using Custom Item Templates
      • Using bootstrap classes in footers
      • Using Grunt
      • Dev Menu
      • How to add a Google Font (WebFont) ?
      • Custom Fields in a Template
      • Site Skins
    • Email Skins/Themes
    • b2evolution Files
    • Website Integration
    • Plugins
    • Debugging
    • Technical Reference
    • Hacks
    • Credits
    • Development
    • How to... (Customize)
    • Scheduled Tasks Reference
  • Operations Reference
  • Advanced Topics
  • Glossary
  • Archives
powered by an open-source CMS

This online manual is powered by b2evolution CMS – A complete engine for your website.

About b2evolution

  • What is it?
  • Features
  • Getting Started
  • Screenshots
  • Online demo
  • Testimonials
  • Design philosophy
  • Free & open source
  • Terms of service

Downloads

  • Latest releases
  • Skins
  • Plugins
  • Language packs

About us

  • About us
  • Contact

Webhosting Guide

  • Web hosting blog
  • Best web hosting
  • Cheap web hosting
  • Green web hosting
  • Hosting with SSH
  • VPS hosting
  • Dedicated servers
  • Reseller hosting
  • Int'l: UK / France

Docs & Support

  • Online manual
  • Forums
  • Hire a pro !

Other

  • Adsense
  • Press room
  • Privacy policy

Stay in touch

  • GitHub
  • Twitter
  • Facebook
  • LinkedIn
  • News blog
  • RSS feed
  • Atom feed

Founded & Maintained by François Planque