我在我的网站中显示来自外部域的一些favicons。问题是,当favicon不同于16px并且我调整它的大小时,输出并不总是完美的。随机地我只得到图像的上半部分或下半部分,当我突然刷新时,图标全部显示。
我在Chrome中遇到过这个问题,90%的时间都是这样,我在Firefox上进行了短暂的测试,但似乎没有发生。
<style>
.icon {
width: 16px;
height: 16px;
</style>
<img class="icon" src="http://getfavicon.appspot.com/http://curiousphotos.blogspot.com/2010/07/creative-gizmos.html">
有没有办法在不撕裂的情况下调整图像大小?
答案 0 :(得分:0)
可以解决你的问题:
<style>
.icon {
width: 16px !important;
height: 16px !important;
</style>
答案 1 :(得分:0)
实际上有几种方法, 1
<style>
.icon {
width: 16px;
height: 16px;
}
</style>
2
<style>
.icon {
max-width: 16px;
max-height: 16px;
}
</style>
3
<img width="16" height="16" class="icon" src="http://getfavicon.appspot.com/http://curiousphotos.blogspot.com/2010/07/creative-gizmos.html" />
我认为#3更适合镀铬