-6ren"> -我正在使用 标签。我的目标群体使用现代浏览器,所以尽快 Firefox supports WebP没有必要使用标签。 现在: 很快: 有没有办法实现 alt-6ren">
gpt4 book ai didi

html - 标签是否有 'alt' 属性? — 用例 : picture element without

转载 作者:行者123 更新时间:2023-12-04 12:06:24 25 4
gpt4 key购买 nike

我正在使用 <picture>标签。我的目标群体使用现代浏览器,所以尽快 Firefox supports WebP没有必要使用<img>标签。

现在:

<picture>
<source srcset="image-200px.webp 1x, image-400px.webp 2x" type="image/webp">
<img src="image-200px.jpg" alt="Description">
</picture>

很快:
<picture>
<source srcset="image-200px.webp 1x, image-400px.webp 2x">
</picture>

有没有办法实现 alt <picture> 的属性不使用时 <img>标签?

最佳答案

My target group uses modern browsers so. As soon as Firefox support WebP there is no need to use the <img> tag



虽然您可能不关心支持不支持 <picture> 的浏览器元素, the HTML specification说:

Content model:

Zero or more source elements, followed by one img element, optionally intermixed with script-supporting elements.


img元素是 强制性 ,所以替代文本仍然由 alt 提供 img 上的属性元素。

关于html - <picture> 标签是否有 'alt' 属性? — 用例 : picture element without <img src ="">,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54400144/

25 4 0