📌  相关文章
📜  之间的区别<figure>&<img> HTML中的标签

📅  最后修改于: 2022-05-13 01:56:34.602000             🧑  作者: Mango

HTML
标签的区别

在本文中,我们将了解

标签及其实现。我们还将了解它们之间的差异。让我们从 HTML 中的图形标签开始讨论。

HTML

标签 HTML5 中的
标签用于添加独立的内容,如插图、图表、照片或文档中的代码列表。它与主流程有关,但可以在文档的任何位置使用,并且图形与文档的流程一致,如果将其移除,则不应影响文档的流程。简单来说,图形标签用于在语义上组织图像、视频、音频甚至图表或表格、HTML 文档中的代码块的内容。

句法:

content

属性:它主要包含两个标签,如下所示:

  • img src 该标签用于在文档中添加图像源。
  • figcaption 此标签用于设置图像的标题。它是可选的。

示例:此示例说明了

标记以及 src、width、height 和 alt 属性的使用。

HTML


  
    
    
    
    Document
    
  
   
  
    
             
Geeks For Geeks
    
  


HTML


  
    
    
    
    Document
    
  
  
    
     

Geeks For Geeks

      


输出:在本例中,

标记已进行了所有更改,因为带有标题的图像与距边距的一些空间正确对齐。图像和标题是彼此的一部分。
标签和
标签都添加了边框,两者都占据了边框。
标签是内联元素。

标签

HTML 标签: HTML 标签用于在网页/网站中添加图像或设置背景。现在的网站不直接将图像添加到网页,因为图像通过使用为图像保留空间的 标记链接到网页。

句法 :

some_text

属性:它包含以下属性值:

  • src:用于指定源图片的URL路径。
  • alt:如果由于某种原因无法显示图像,则用于指定图像的替代文本。

示例:在此示例中,我们使用 标记以及 src、width、height 和 alt 属性。

HTML



  
    
    
    
    Document
    
  
  
    
     

Geeks For Geeks

      

输出: 标签的情况下,它没有正确对齐并且非常靠近边缘,并且标题远离图像。图像和标题不是彼此的一部分。边框不是图像和标题的一部分。 标签是一个内联元素,但是当我们指定宽度和高度时,它就变成了一个块元素。

图片标签

标签

标签的区别:

S.No.

Tag

Tag

1.The figure tag is used to semantically organize the content of images, videos, audios or even charts or tables, block of codes in the HTML document.The image tag is used to add an image to an   HTML page. tag can only insert image.
2.
tag is a container tag.
tag is a void tag.
3.This tag provides a container for content that is equivalent to a figure or diagram in a book.The HTML tag is used for embedding images into an HTML document.
4.This tag is inline element.It is an inline element but when we specify width and height it becomes a block element.
5.You can use the figure element in conjunction with the figcaption element to provide a caption for the contents of your figure element.In image tag there’s no special tag for caption rather we can use

tag or tag to add pseudo captions.

6.It makes it easy for the machine to understand the code. Easy to get on search engines.It is difficult for machines to understand.
7.The
element itself may contain multiple other child elements be it a block of code, images, audios, video etc.
The tag can not have multiple elements inside it only images can be added in tag.
8.The figure tag contains default alignment and styling.The image tag does not contain any default alignment and styling.