<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" mrc="text/html; charset=gb2312" />
<title>CSS强制图片自适应宽度</title>
<style type="text/css">
img {width:expression(this.width>100?"360px":this.width+"px");}
</style>
</head>
<body>
如果LOGO宽度大于100像素则强制显示为360像素宽,高度没有定义。实际上LOGO宽度为210像素。<br><br>
<div>
<img src="https://www.31jz.com/static/upload/image/20221116/1668592599535624.png" />
</div>
</body>
</html>
本文地址:https://31jz.com/jzjc/1107.html