search
HomeWeb Front-endH5 TutorialHTML5 semantic summary

HTML5 semantic summary

May 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
Mastering Microdata: A Step-by-Step Guide for HTML5Mastering Microdata: A Step-by-Step Guide for HTML5May 14, 2025 am 12:07 AM

MicrodatainHTML5enhancesSEOanduserexperiencebyprovidingstructureddatatosearchengines.1)Useitemscope,itemtype,anditempropattributestomarkupcontentlikeproductsorevents.2)TestmicrodatawithtoolslikeGoogle'sStructuredDataTestingTool.3)ConsiderusingJSON-LD

What's New in HTML5 Forms? Exploring the New Input TypesWhat's New in HTML5 Forms? Exploring the New Input TypesMay 13, 2025 pm 03:45 PM

HTML5introducesnewinputtypesthatenhanceuserexperience,simplifydevelopment,andimproveaccessibility.1)automaticallyvalidatesemailformat.2)optimizesformobilewithanumerickeypad.3)andsimplifydateandtimeinputs,reducingtheneedforcustomsolutions.

Understanding H5: The Meaning and SignificanceUnderstanding H5: The Meaning and SignificanceMay 11, 2025 am 12:19 AM

H5 is HTML5, the fifth version of HTML. HTML5 improves the expressiveness and interactivity of web pages, introduces new features such as semantic tags, multimedia support, offline storage and Canvas drawing, and promotes the development of Web technology.

H5: Accessibility and Web Standards ComplianceH5: Accessibility and Web Standards ComplianceMay 10, 2025 am 12:21 AM

Accessibility and compliance with network standards are essential to the website. 1) Accessibility ensures that all users have equal access to the website, 2) Network standards follow to improve accessibility and consistency of the website, 3) Accessibility requires the use of semantic HTML, keyboard navigation, color contrast and alternative text, 4) Following these principles is not only a moral and legal requirement, but also amplifying user base.

What is the H5 tag in HTML?What is the H5 tag in HTML?May 09, 2025 am 12:11 AM

The H5 tag in HTML is a fifth-level title that is used to tag smaller titles or sub-titles. 1) The H5 tag helps refine content hierarchy and improve readability and SEO. 2) Combined with CSS, you can customize the style to enhance the visual effect. 3) Use H5 tags reasonably to avoid abuse and ensure the logical content structure.

H5 Code: A Beginner's Guide to Web StructureH5 Code: A Beginner's Guide to Web StructureMay 08, 2025 am 12:15 AM

The methods of building a website in HTML5 include: 1. Use semantic tags to define the web page structure, such as, , etc.; 2. Embed multimedia content, use and tags; 3. Apply advanced functions such as form verification and local storage. Through these steps, you can create a modern web page with clear structure and rich features.

H5 Code Structure: Organizing Content for ReadabilityH5 Code Structure: Organizing Content for ReadabilityMay 07, 2025 am 12:06 AM

A reasonable H5 code structure allows the page to stand out among a lot of content. 1) Use semantic labels such as, etc. to organize content to make the structure clear. 2) Control the rendering effect of pages on different devices through CSS layout such as Flexbox or Grid. 3) Implement responsive design to ensure that the page adapts to different screen sizes.

H5 vs. Older HTML Versions: A ComparisonH5 vs. Older HTML Versions: A ComparisonMay 06, 2025 am 12:09 AM

The main differences between HTML5 (H5) and older versions of HTML include: 1) H5 introduces semantic tags, 2) supports multimedia content, and 3) provides offline storage functions. H5 enhances the functionality and expressiveness of web pages through new tags and APIs, such as and tags, improving user experience and SEO effects, but need to pay attention to compatibility issues.

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

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