This gist explores a fairly complex approach to semantic html. Keep in mind that because it is all just 1 wiki page, you could get rid of the article
tags and just use sections.
However This is meant to show a more complex example in practice. Base your code on the needs of your content.
- Semantic breaks in your page need headings.
-This includes article, header, section - heading next must be sequential (no h2 before h1) extra reading
- Headers can be used as headers for different sections and the whole page
- If it's the header for a section, put it inside the section
- Note how this page has a top level header that is just under the body
- Then following headers are inside their respective container elements
- Use when there is a semantically bound block of information.
- If the segment of content can be taken out of the rest of the page and still make sense, then it can be an article
- In this website's case, arguably all of the content could be in an
article
or `main
- On wikipedia, this tag is used directly under headings.
- This is no longer recommended. It is better to use them for semantic breaks only
- ie: all the articles could be removed and an
hr
tag could be between them - They can be used in conjunction with
article
tags as well.
- ie: all the articles could be removed and an
- Instead, use underline on the text to fulfill the same purpose
- this page shows them being used properly.
- An indepth guide to underlining elements
- This is no longer recommended. It is better to use them for semantic breaks only
- Local Navigation
- To make links that go to different places on the same page:
- Add an id to the destination (ie: line 50)
- link to that id (ie: line 14)
- To make links that go to different places on the same page:
- External Navigation
- Add the url to the destination in the
href
- in your
<a>
tag, add target="_blank"` to open the link in a new tab.- This can be done for local links too
- Add the url to the destination in the