我有90版的Chrome,所以<picture>标签应该在这里工作。但总有退路的时候。当我评论<img>时,屏幕上没有显示任何内容。
守则:
<picture>
<source media="(max-width: 400px)" srcset="./public/forest_400.jpg, ./public/forest_768.jpg 2x">
<source media="(min-width: 401px)" srcset="./public/forest_768.jpg">
<img
class="srcset"
src="./public/forest_768.jpg"
alt="a beautiful art in blue and yellow colors with river and forest on both sides of it during sunset or sundown"
>
</picture>我在网上找不到任何解决办法。会很感激你的帮助!
发布于 2021-05-31 11:26:27
@DanMacák在他的评论中说:
MDN说它有两个用途。一个是回退,另一个是显示选定的源(或回退):“然后在元素占用的空间中显示选定的图像。”developer.mozilla.org/en-US/docs/Web/HTML/Element/picture。
所以这段代码没有问题。我要结束这个问题。
https://stackoverflow.com/questions/67758846
复制相似问题