search
HomeWeb Front-endH5 TutorialHTML5 semantic summary
HTML5 semantic summaryMay 27, 2017 am 10:16 AM

Html semantic understanding

## 1. What is HTML semantics?

Basically it revolves around several main tags, such as title (H1~H6), list (li), emphasis (strong em), etc.>

Based on the structure of the content (content semantics), choosing appropriate tags (code semantics) facilitates developers to read and write more elegant code, while allowing browser crawlers and machines to parse it well.


 2. Why semantics?

In order to present a good content structure and code structure on the page without CSS: in order to look good when running naked;

User experience: for example, title and alt are used Explain nouns or explain picture information, and the flexible use of label tags;

It is beneficial to SEO: establish good communication with search engines, which helps crawlers to crawl more effective information: crawlers rely on tags to determine the context and the weight of each keyword;

to facilitate other device parsing (such as screen readers, blind readers, mobile devices) to render web pages in a meaningful way;

It is easier for team development and maintenance, and semantics are more readable. It is an important trend in the next step of web pages. Teams that follow W3C standards all follow this standard, which can reduce differentiation.


## 3. What should you pay attention to when writing HTML code?

Use the unsemantic tags p and span as little as possible;

When the semantics are not obvious, you can use p or p, try to use p, because p By default, there is upper and lower spacing, which is beneficial for compatibility with special terminals;

Do not use pure style tags, such as: b, font, u, etc., use css settings instead.

Text that needs to be emphasized can be included in the strong or em tag (browser default style, if you can specify it with CSS, do not use them), the default style of strong is bold (do not use b), em is in italics (without i);

When using a table, use caption for the title, thead for the table header, tbody for the main part, and tfoot for the tail.

Table headers should be distinguished from ordinary cells. Use th for table headers and td for cells;

Form fields should use fieldset tags Wrap it up and use the legend tag to explain the purpose of the form;

The description text corresponding to each input tag needs to use the label tag, and set the id attribute for the input in the label tag for=someld to associate the description text with the corresponding input.


##  4. What new semantic tags are added to HTML5

The goal of HTML5: write more concise HTML code and create simpler Web programs.

Exciting new features are as follows: new html tags and attributes, full support for CSS3, video and audio tags, 2D/3D drawing, local storage, and local SQL database.

Why should we introduce semantic elements: to allow developers to more intuitively understand the menu of each part of the page, and at the same time, search engines and screen readers used by visually impaired people can also more easily identify every part of the page.

HTML5 semantic summary##  

Block tag: Tag article: Indicates an independent piece of content contained in a document, page, application or website, that is, it can be published or reused independently.

## 

Use

Some examples of using article: a blog, a forum post, a news report, a user comment.


Tag header

## Usually placed At the top of the page, or at the top of a certain block element in the page, it contains the title, introduction and other information of the entire page or a certain block.

A document can contain more than one header tag; the header tag does not have to be displayed at the top of the page. Its content determines the need to use the header tag here. The position is not important; it can be body, article , section and aside add header elements.


Tag footer

Generally placed At the bottom of the page, or at the bottom of a block element on the page.


##  Tagsnav

## Represents the navigation of the page, which can be connected to other pages of the website or other parts of the current page through navigation.

Search engines or screen readers will determine website content based on nav tags. Not any set of hyperlinks is suitable for placement in nav tags.


## Contents contained in the tag aside

## It is not the main content of the page, but independent and supplements the content of the page.

Some examples of using aside: page sidebar; advertisements; friendly links; article quotations (content summary).


## Tag section

A topic Content grouping usually contains a header and possibly a footer.

Comparison between tag p and section: tag p is more widely used. As long as you want to define a style for a region, you can use the p tag; the content contained in the tag section is a clear The topic, usually with a title area.

## Content grouping tags:


Tagmain

Display the main body of the page Content; Each page can only contain one main tag; the main tag does not contain website title, logo, main navigation, copyright statement and other information.

## Tag figure

Define media content groups, and their titles.

## Tag figcaption


## Define figure element title.

Text-level semantic tags:

## Tag time


New tag for HTML5. Represents a date, a time, or both a date and time value.

## Tags i and b

## HTML4 Tags that already exist are given new semantic functions in HTML5.

## Tags i

In HTML4 , is to modify the text style and display the text as italicized text; in HTML5, it means to emphasize different emotions or sounds, and can also represent technical terms, biological classification, idioms or idioms from another language, an idea, etc. .


## Tag b

In HTML4, It modifies the text style and displays the text as bold text; in HTML5, it represents keywords, product names, etc. in the document.


## Tag em and strong

## in HTML4 already has semantic functions.

Tag em: emphasis, the content in the tag is used to emphasize the key content, and will be displayed as italic text by the browser.

Tag strong: Indicates very important, serious or urgent content; will be displayed as bold text by the browser.

Usage suggestions: If you simply want to display the text style as italics or bold, please do not use these semantic tags. W3C recommends that we define text styles in CSS style sheets.

The above is the detailed content of HTML5 semantic summary. For more information, please follow other related articles on the PHP Chinese website!

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
html5的div一行可以放两个吗html5的div一行可以放两个吗Apr 25, 2022 pm 05:32 PM

html5的div元素默认一行不可以放两个。div是一个块级元素,一个元素会独占一行,两个div默认无法在同一行显示;但可以通过给div元素添加“display:inline;”样式,将其转为行内元素,就可以实现多个div在同一行显示了。

html5中列表和表格的区别是什么html5中列表和表格的区别是什么Apr 28, 2022 pm 01:58 PM

html5中列表和表格的区别:1、表格主要是用于显示数据的,而列表主要是用于给数据进行布局;2、表格是使用table标签配合tr、td、th等标签进行定义的,列表是利用li标签配合ol、ul等标签进行定义的。

html5怎么让头和尾固定不动html5怎么让头和尾固定不动Apr 25, 2022 pm 02:30 PM

固定方法:1、使用header标签定义文档头部内容,并添加“position:fixed;top:0;”样式让其固定不动;2、使用footer标签定义尾部内容,并添加“position: fixed;bottom: 0;”样式让其固定不动。

HTML5中画布标签是什么HTML5中画布标签是什么May 18, 2022 pm 04:55 PM

HTML5中画布标签是“<canvas>”。canvas标签用于图形的绘制,它只是一个矩形的图形容器,绘制图形必须通过脚本(通常是JavaScript)来完成;开发者可利用多种js方法来在canvas中绘制路径、盒、圆、字符以及添加图像等。

html5中不支持的标签有哪些html5中不支持的标签有哪些Mar 17, 2022 pm 05:43 PM

html5中不支持的标签有:1、acronym,用于定义首字母缩写,可用abbr替代;2、basefont,可利用css样式替代;3、applet,可用object替代;4、dir,定义目录列表,可用ul替代;5、big,定义大号文本等等。

html5废弃了哪个列表标签html5废弃了哪个列表标签Jun 01, 2022 pm 06:32 PM

html5废弃了dir列表标签。dir标签被用来定义目录列表,一般和li标签配合使用,在dir标签对中通过li标签来设置列表项,语法“<dir><li>列表项值</li>...</dir>”。HTML5已经不支持dir,可使用ul标签取代。

html5是什么意思html5是什么意思Apr 26, 2021 pm 03:02 PM

html5是指超文本标记语言(HTML)的第五次重大修改,即第5代HTML。HTML5是Web中核心语言HTML的规范,用户使用任何手段进行网页浏览时看到的内容原本都是HTML格式的,在浏览器中通过一些技术处理将其转换成为了可识别的信息。HTML5由不同的技术构成,其在互联网中得到了非常广泛的应用,提供更多增强网络应用的标准机。

Html5怎么取消td边框Html5怎么取消td边框May 18, 2022 pm 06:57 PM

3种取消方法:1、给td元素添加“border:none”无边框样式即可,语法“td{border:none}”。2、给td元素添加“border:0”样式,语法“td{border:0;}”,将td边框的宽度设置为0即可。3、给td元素添加“border:transparent”样式,语法“td{border:transparent;}”,将td边框的颜色设置为透明即可。

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)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment