search
HomeWeb Front-endH5 TutorialHTML5 document structure

HTML5 document structure

Feb 09, 2017 pm 04:17 PM
html5

The document structure of HTML5

HTML5 is much simplified, and its design follows three principles: 1. Compatibility, 2. Practicality, 3 .Universal accessibility

1. header element

The

tag defines the header of a document or a part of a document, and can also be used to set the article title.

The

element should serve as a container for introductory content or a navigation link bar.

In a document, you can define multiple

elements.

Note: The

tag cannot be placed inside a
,
or another
element.

Syntax description:

tag pairs can contain six title elements h1~h6, as well as p, span and other elements.

hgroup element

The

tag defines the main title and subtitle of the document. Only six title elements h1~h6 are usually used between tag pairs.

2. footer element

The footer element is mainly used to define footnote content for a page or an article, including the copyright information of the article, author contact information, etc. A page can contain multiple footers. element.

Example:


##

<footer>
   <ul>
     <li>Copyright © 2000-2013 华软 All Rights Reserved</li>
     <li>学院地址:广州.从化.广从大道13号 电话:020-87818918</li>
   </ul>
</footer> 

3. article element

Tags define independent content, a piece of independent content on the page that is not relevant to the context. For example, a post, a blog post, etc.

The content defined by the
tag must be meaningful in itself and must be independent of the rest of the document.

Potential sources for
: forum posts, blog posts, news stories, comments, etc.

Syntax description:
tag pairs can contain elements such as header, footer, section, and nested article.

Example:


<article>
  <header>
    <h2 id="写给IT职场新人的六个-关于">写给IT职场新人的六个“关于”</h2>
  </header>
  <p>
    <b>关于工作地点</b> ...
  </p>
  ...
</article>

4. section element

The section element is used Divide a certain block of content on the page, such as further dividing the block of content into several parts such as the chapter title, content, and footer.

Syntax description:
The tag pair can contain six title elements h1~h6, p elements and multiple article elements

"Block" contains multiple articles inside. In addition, section elements can be nested.

Example:


<article>
  <header>
    <h2 id="写给IT职场新人的六个-关于">写给IT职场新人的六个“关于”</h2>
  </header>
  <section> 
    <h3 id="关于工作地点">关于工作地点</h3>
    <p>...</p>
  </section>
  <section> <h3 id="关于企业">关于企业</h3> <p>...</p> </section>
  ...
</article>

5. nav element

The nav element is used Define various navigation bars on the page. A page can have multiple nav elements as navigation for the entire page or different parts of the content.

The only impossible position for nav is within the address element

Basic syntax:

<nav><a>#</a><a>#</a><a>#</a></nav>

6. aside element

The aside element represents auxiliary information related to the content of the article element in addition to the content of the article element.

It can include references, sidebars, and advertisements related to the current page or main content. , navigation bars, and other similar parts that are distinct from the main content.

7. audio audio tag


The audio tag defines sound, such as music or other audio streams.

Currently, the audio element supports three file formats: MP3, Wav, and Ogg.


<audio></audio>


# Properties Description

src URL of the audio to be played

autoplay Play the audio as soon as it is ready

controls Display audio controls to the user, such as play/pause buttons

loop Restart playback whenever the audio ends

preload The audio is loaded when the page loads and is ready to play

8. video video tag


video tag Defines video, such as a movie clip or other video stream.

Currently, the video element supports three video formats: MP4, WebM, and Ogg.


<video></video>

## Property Description

src The video to be played URL

width Set the width of the video player

height Set the height of the video player

autoplay The video will be played as soon as it is ready

controls to the user Display video controls, such as play/pause buttons

loop Start playing again after the media file has finished playing

    muted      规定视频的音频输出应该被静音

    poster     规定视频下载时显示的图像,或者在用户点击播放按钮前显示的图像

    preload    视频在页面加载时进行加载并预备播放,属性值(none:只有单击了Play按钮才加载视频;metadata:仅加载元数据,例如视频长度、作者、版权)

    9. 图形中的 figure 及 figcaption

    元素figure及figcaption实际上不能算作结构性元素,但在组织独立图片、图像、图表及编码列表时仍然很受欢迎。

    每一个figure元素中只能包括一个figcaption元素。图片排列一起可用。百度文库里有篇“绚丽的HTML5 Figure图片字幕标题特效”

    常常用到一种图片列表,图片+标题或者图片+标题+简单描述。

    实例代码:

   

黄浦江上的的卢浦大桥

HTML5 document structure

    figure用来代替原来li标签,P标签谁来取代呢?答案就是:figcaption

    w3c赋予的定义:figcaption 标签定义 figure 元素的标题(caption)。"figcaption" 元素应该被置于 "figure" 元素的第一个或最后一个子元素的位置。

    那么上面的代码就变成了:


    <figure>
    <figcaption>黄浦江上的的卢浦大桥</figcaption>
    <img  src="/static/imghwm/default1.png" data-src="images/黄浦江上的的卢浦大桥.jpg" class="lazy" alt="HTML5 document structure" >
    </figure>

    效果图如下:


黄浦江上的的卢浦大桥

HTML5的文档结构 - 不报错才可怕

更多HTML5的文档结构 - 不报错才可怕相关文章请关注PHP中文网!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
H5: Tools, Frameworks, and Best PracticesH5: Tools, Frameworks, and Best PracticesApr 11, 2025 am 12:11 AM

The tools and frameworks that need to be mastered in H5 development include Vue.js, React and Webpack. 1.Vue.js is suitable for building user interfaces and supports component development. 2.React optimizes page rendering through virtual DOM, suitable for complex applications. 3.Webpack is used for module packaging and optimize resource loading.

The Legacy of HTML5: Understanding H5 in the PresentThe Legacy of HTML5: Understanding H5 in the PresentApr 10, 2025 am 09:28 AM

HTML5hassignificantlytransformedwebdevelopmentbyintroducingsemanticelements,enhancingmultimediasupport,andimprovingperformance.1)ItmadewebsitesmoreaccessibleandSEO-friendlywithsemanticelementslike,,and.2)HTML5introducednativeandtags,eliminatingthenee

H5 Code: Accessibility and Semantic HTMLH5 Code: Accessibility and Semantic HTMLApr 09, 2025 am 12:05 AM

H5 improves web page accessibility and SEO effects through semantic elements and ARIA attributes. 1. Use, etc. to organize the content structure and improve SEO. 2. ARIA attributes such as aria-label enhance accessibility, and assistive technology users can use web pages smoothly.

Is h5 same as HTML5?Is h5 same as HTML5?Apr 08, 2025 am 12:16 AM

"h5" and "HTML5" are the same in most cases, but they may have different meanings in certain specific scenarios. 1. "HTML5" is a W3C-defined standard that contains new tags and APIs. 2. "h5" is usually the abbreviation of HTML5, but in mobile development, it may refer to a framework based on HTML5. Understanding these differences helps to use these terms accurately in your project.

What is the function of H5?What is the function of H5?Apr 07, 2025 am 12:10 AM

H5, or HTML5, is the fifth version of HTML. It provides developers with a stronger tool set, making it easier to create complex web applications. The core functions of H5 include: 1) elements that allow drawing graphics and animations on web pages; 2) semantic tags such as, etc. to make the web page structure clear and conducive to SEO optimization; 3) new APIs such as GeolocationAPI support location-based services; 4) Cross-browser compatibility needs to be ensured through compatibility testing and Polyfill library.

How to do h5 linkHow to do h5 linkApr 06, 2025 pm 12:39 PM

How to create an H5 link? Determine the link target: Get the URL of the H5 page or application. Create HTML anchors: Use the <a> tag to create an anchor and specify the link target URL. Set link properties (optional): Set target, title, and onclick properties as needed. Add to webpage: Add HTML anchor code to the webpage where you want the link to appear.

How to solve the h5 compatibility problemHow to solve the h5 compatibility problemApr 06, 2025 pm 12:36 PM

Solutions to H5 compatibility issues include: using responsive design that allows web pages to adjust layouts according to screen size. Use cross-browser testing tools to test compatibility before release. Use Polyfill to provide support for new APIs for older browsers. Follow web standards and use effective code and best practices. Use CSS preprocessors to simplify CSS code and improve readability. Optimize images, reduce web page size and speed up loading. Enable HTTPS to ensure the security of the website.

How to generate links with h5How to generate links with h5Apr 06, 2025 pm 12:33 PM

h5 pages can generate links in two ways: create links manually or use short link services. By manually creating, you just need to copy the URL of the h5 page; through the short link service, you need to paste the URL into the service and then get the shortened URL.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.