我在我的网站上使用srcset作为响应式图像:
template<typename tParam>
Debug &operator<<(Debug& stream, tParam const & myParam)
{
...
return stream;
}
我并不特别喜欢它渲染图像的方式。例如,当我在400px宽度的屏幕上时,会显示768w图像。我编写了以下代码来处理手动调整大小:
<img src="images/house-1915.jpg"
srcset="images/house-544.jpg 544w, images/house-768.jpg 768w, images/house-992.jpg 992w, images/house-1200.jpg 1200w, images/house-1915.jpg 1915w"
alt="House" class="hero-image">
我很好奇如果删除srcset并使用上面的代码在页面加载时设置img src是否有效?