使用< picture>内部< figure>HTML5中的元素? [英] Use of <picture> inside <figure> element in HTML5?

查看:50
本文介绍了使用< picture>内部< figure>HTML5中的元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在HTML5中,我们目前有一个< figure> 元素,其定义如下( W3C参考)

In HTML5 we currently have a <figure> element, defined like so (W3C reference)

Figure元素表示一个内容单元,可以选择包含标题,该内容单元是独立的,通常从文档的主流中引用为单个单元,并且可以从文档的主流中移开.文档而不会影响文档的含义.

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.

最近,响应图像提出了一个新元素< picture> 社区组,它的定义是

用于显示可能来自多种来源的图像的图片元素(请参见srcset属性).用户代理显示哪个图像取决于导出源图像的算法.

The picture element used for displaying an image that can come from a range of sources (see srcset attribute). Which image the user agent displays depends on the algorithm for deriving the source image.

由于这两个描述似乎并不矛盾(并且图片上的文档处于草稿状态),所以我的问题是:是否可以(技术上和语义上)嵌套一个图片放在 figure 元素中的方式?

Since the two descriptions seems to be not contradictory (and documentation on picture is on draft state yet) here my question: is it possible (technically and semantically) to have a nested picture inside a figure element, in this way?

<figure>
   <picture>
      <source ...>
      <source ...>
      <source ...>
      <img..>
   </picture>

   <figcaption>...</figcaption>
</figure>

我在规格中没有找到关于它的参考.:\

I've found no references about it in specs. :\

注意:我知道目前没有浏览器实现此元素,我只是在 jQuery图片上做一些实验.>

Note: I'm aware that no browser implements currently this element, I'm just making some experiments with jQuery picture

谢谢.

推荐答案

您尚未找到它,因为它实际上尚未正式发布,但我将假定答案为,即很好.

You won't find it since it's not actually official yet, but I am going to assume the answer is yes, that is fine.

此刻,您可以执行以下操作:

At the moment, you do something like:

<figure>
  <img src="image.jpg" alt="The Image">
  <figcaption>A Caption</figcaption>
</figure>

< picture> 只是意味着对响应站点具有多个src'd < img> 的方法,因此从技术上讲,就像-如果它被批准-您的示例是有效的.

and <picture> is simply meant to be the a method of have a multiple src'd <img> for responsive sites, so technically it would seem like -- if it were approved -- your example is valid.

这篇关于使用&lt; picture&gt;内部&lt; figure&gt;HTML5中的元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆