在曾经的 淘宝UED 招聘 中有这样一道题目:
至于如何解决,下面是一个权衡的相对结构干净,CSS简单的解决方法:
1 | .box { |
1 | <div class="box"> |
当然还有其他的解决方法,在此不深究,有兴趣的可以阅读下:
1 | .new_proimg{ |
版本2
HTML代码:
1 | <div class=”demo”><a href=“#”><img src=“images/01.jpg” /></a></div> |
CSS代码:
1 | /*For Firefox Chrome*/ |
其中For IE6中的css有这么一段:
1 | width:expression(this.width>200?“200px”:“auto”);height:expression(this.height>140?“140px”:“auto”); |
这是限制IE6下图片的最大宽和最大高,就像非IE6下的:
1 | max-width:200px;max-height:140px; |