- ·上一篇文章:html页面传值问题
- ·下一篇文章:利用层模拟在textarea中插入图片
当前位置:K88软件开发 → 文章中心 → 编程语言 → Css/Css3 → Css/Css301 → 文章内容
CSS控制图片宽度:当图片超过300px的时候,只显示300px的宽度
功能:当图片超过300px的时候,只显示300px的宽度
来源:asp编程网(www.K88.NET)
作者:wangsdong
<
style type="
text/css"
>
img
{ max-width:300px
width:expression(document.body.clientWidth>
300px?"
300px"
:this.value+"
px"
)
overflow:hidden
}
<
/style>
<
img src=http://www.aspbc.com/Index/showtech/id/"
images/a.jpg"
alt="
"
/>
<
br />
<
img src=http://www.aspbc.com/Index/showtech/id/"
images/b.jpg"
alt="
"
/>
CSS控制图片宽度:当图片超过300px的时候,只显示300px的宽度