html - <picture>元素srcset顺序重要性

标签 html image responsive-design srcset

源命令是否添加了 <source>元素重要吗?我将添加多种文件格式并使用类型属性来支持浏览器。所以如果没有media标签来引导浏览器。它如何选择要使用的源标记?

最佳答案

Very much like it does when using the sizes algorithm, the browser goes over the list of sources and picks the first one that matches. A match can happen based on both media and type attributes.

引用来自Native responsive images

链接到规范,我有时觉得很难阅读并获得直接答案:select-an-image-source

关于html - <picture>元素srcset顺序重要性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39644823/

相关文章:

html - 在 block 内联 div 中居中图像

css - 无法将 Twitter Bootstrap core 和 responsive 编译成一个文件?

html - 带有静态列的响应式表格布局?

javascript - 查找div相对于窗口的左侧位置

jquery - 如何在背景叠加层上添加 jQuery 动画

javascript - in querySelector : how to get the first and get the last elements? 在dom中使用什么遍历顺序?

html - 我怎样才能将图像和它的文本组合在一起,以便它们可以

javascript - 在javascript中从另一个html元素获取元素内容

php - php 能做我想做的事吗?

html - 自定义 Bootstrap 的汉堡菜单