div
containers with the name of the corresponding class or unique identifier for each of them.
div
containers with class
and id
attributes. It contains a header, a horizontal block of navigation elements, a block for the main text of the page, an auxiliary column to the right of it, and a footer.
div
elements are actively used for the reason that the current version of the HTML standard lacks semantic elements with which it would be possible to describe the blocks of pages listed above more specifically. The HTML 5 standard takes this flaw into account and provides a number of new tags for the individual description of each block of typical markup.
div
containers are replaced in our example with new elements: header
, nav
, section
, article
, aside
, and footer
. The HTML code thus takes the following form:
<body>
<header>...</header>
<nav>...</nav>
<article>
<section>
...
</section>
</article>
<aside>...</aside>
<footer>...</footer>
</body>
h1
- h6
). The specification describes in detail the algorithm for the formation of a table of contents , which not only takes into account new structural elements, but also maintains backward compatibility with the previous version of the standard. This innovation can be used to automatically generate a table of contents, which will simplify navigation within web pages.
section
and h1
containers:
<h1>Level 1</h1>
<section>
<h1>Level 2</h1>
<section>
<h1>Level 3</h1>
</section>
</section>
h1
it is also possible to use headers of other levels ( h2
- h6
).
head
element is interpreted as a section header. Such containers, if necessary, can contain not only the name itself, but also a subtitle, a history of changes, a link to the author, and any other information that is logical to refer to the title part.
<header>
<h1>A Preview of HTML 5</h1>
<p class="byline">By Lachlan Hunt</p>
</header>
<header>
<h1>Example Blog</h1>
<h2>Insert tag line here.</h2>
</header>
footer
element is the final block of the section to which it belongs (an analogue of the footer for the paper page). Such blocks, as a rule, contain supporting information about the section. For example, links to related materials, copyright information, etc.
<footer>© 2007 Example Inc.</footer>
nav
intended for navigation links, which is useful both for cross-page navigation within the site, and for in-page navigation (for organizing the table of contents).
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/products">Products</a></li>
<li><a href="/services">Services</a></li>
<li><a href="/about">About</a></li>
</ul>
</nav>
aside
container is used for supporting materials, for example, for defining additional columns with background text (sidebars).
<aside>
<h1>Archives</h1>
<ul>
<li><a href="/2007/09/">September 2007</a></li>
<li><a href="/2007/08/">August 2007</a></li>
<li><a href="/2007/07/">July 2007</a></li>
</ul>
</aside>
section
element is interpreted as a general purpose section. Such a section may be, for example, a paragraph.
<section>
<h1>Chapter 1: The Period</h1>
<p>It was the best of times, it was the worst of times,
it was the age of wisdom, it was the age of foolishness,
it was the epoch of belief, it was the epoch of incredulity,
it was the season of Light, it was the season of Darkness,
...</p>
</section>
article
defines independent sections of a document, page, or site. This element can be used to highlight news, forum posts, posts or comments on a blog, etc.
<article id="comment-2">
<header>
<h4><a href="#comment-2" rel="bookmark">Comment #2</a>
by <a href="http://example.com/">Jack O'Niell</a></h4>
<p><time datetime="2007-08-29T13:58Z">August 29th, 2007 at 13:58</time>
</header>
<p>That's another great article!</p>
</article>
video
and audio
tags this will be really easy. Most of the functions of their API will be the same, with only one difference in orientation towards the reproduction of visual and non-visual material.
video
tag. You can already download an experimental version of Opera browser or the latest WebKit weekly build to demonstrate how the following code examples work. Opera has support for Ogg Theora , and WebKit understands all the formats that QuickTime has, including third-party codecs.
video
container, as shown in the following example. The controls
attribute is used to determine whether the interface of a standard media player should be displayed or not (in our case, playback controls will be displayed).
<video src="video.ogv" controls poster="poster.jpg"
width="320" height="240">
<a href="video.ogv">Download movie</a>
</video>
poster
attribute can be used to define a static image displayed in the video
container before the recording starts playing. There are video formats that have a similar built-in capability (for example, MPEG4), but using the approach described above allows you to achieve this functionality without reference to a specific codec.
audio
element. Most of the attributes of the audio and video
tags are the same, but audio, for obvious reasons, lacks width
, height
and poster
.
<audio src="music.oga" controls>
<a href="music.oga">Download song</a>
</audio>
source
tags, the src
attribute of the audio
and video
containers should be omitted, otherwise the source
tags will be ignored.
<video poster="poster.jpg">
<source src="video.3gp" type="video/3gpp"
media="handheld">
<source src="video.ogv" type="video/ogg;
codecs="theora, vorbis">
<source src="video.mp4" type="video/mp4">
</video>
<audio>
<source src="music.oga" type="audio/ogg">
<source src="music.mp3" type="audio/mpeg">
</audio>
play()
and pause()
methods (the meaning of which is clear from the name), as well as the currentTime
property, which in the following example is used to “rewind” the video to the beginning.
<video src="video.ogg" id="video"></video>
<script>
var video = document.getElementById("video");
</script>
<p>
<button type="button" onclick="video.play();">Play</button>
<button type="button" onclick="video.pause();">Pause</button>
<button type="button" onclick="video.currentTime = 0;">
<< Rewind</button>
</p>
title
element in the head
container, as well as h1
and p
in the body
.
<!DOCTYPE html>
<html>
<head>
<title>An HTML Document</title>
</head>
<body>
<h1>Example</h1>
<p>This is an example HTML document.
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>An HTML Document</title>
</head>
<body>
<h1>Example</h1>
<p>This is an example HTML document.</p>
</body>
</html>
xmlns
attribute is present here, as well as the closing p
tag (whose presence in the XML context is required). To determine the difference between serialization, browsers will use a MIME type value. Any document defined as text/html
must comply with the HTML serialization requirements. If the MIME type is application/xhtml+xml
, the XML serialization requirements must be satisfied.
Source: https://habr.com/ru/post/31320/