HTML5图形与img的用途是什么

2022-01-18 00:00:00 image figure tags difference html

使用 HTML5 是否有任何特定的优势/用法<图> <img>?

我认为 <figure> 没有 <figurecaption>,不是吗?

举例说明会很有帮助.

解决方案

从技术上讲,图像不是插入到 HTML 页面中,而是链接到 HTML 页面.<img> 标签为引用的图像创建一个保存空间.

虽然<figure>元素的内容与主流程相关,但其位置与主流程无关,移除后不影响文档的流程p>

来自 http://dev.w3.org/

img 元素代表一个图像. 而 figure 元素代表一个内容单元,可选带有标题,它是自包含的,通常作为单个单元从文档的主要流程中引用,并且可以从文档的主要流程中移开而不影响 文档的含义.

Is there any specific advantage/usage of using HTML5 <figure> over <img>?

I think <figure> is useless without <figurecaption>, isn't it?

It will be helpful if explain with an example.

解决方案

Images are not technically inserted into an HTML page, images are linked to HTML pages. The <img> tag creates a holding space for the referenced image.

While the content of the <figure> element is related to the main flow, its position is independent of the main flow, and if removed it should not affect the flow of the document

From http://dev.w3.org/

The img element represents an image. and the The figure element represents a unit of content, optionally with a caption, that is self-contained, that is typically referenced as a single unit from the main flow of the document, and that can be moved away from the main flow of the document without affecting the document’s meaning.

相关文章