【发布时间】:2013-05-19 22:53:59
【问题描述】:
问。就图像加载时间和性能而言,哪种技术最有效...?
场景 1。
是不是通过媒体查询来加载不同尺寸的图片,如下:
/* Smartphone */
@media screen and (max-width: 320px) {
.img-page-1-img {
background: url('../images/img-page-1-img-117.jpg') no-repeat;
width: 117px;
height: 77px;
}
}
/* Desktop */
@media only screen and (min-width: 769px) {
.img-page-1-img {
background: url('../images/img-page-1-img-234.jpg') no-repeat;
width: 234px;
height: 154px;
}
}
或者...
场景 2。
加载一张大图片并使用 CSS 通过设置 max-width 属性来“拉伸”和调整大小..?
img {
max-width: 100%;
}
谢谢....
【问题讨论】:
-
好吧,在任何情况下加载“大”图像,即使页面在非常小的屏幕上查看,对于加载时间或性能都没有好处,应该非常明显,或者不是吗?
标签: html css responsive-design