范例必读 (三)[table 中 img 自适应 div 大小缩放]

本文探讨了如何在HTML表格中实现图片自适应div大小的缩放技巧,通过合理使用div、table、CSS样式及class属性,确保图片在不同屏幕尺寸下保持良好显示效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!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" content="text/html">
	<link rel="stylesheet" style="text/css" href="css.css">
	<title>test3</title>
<style>
</style>
</head>
<body>

<hr/>
<table align="center">
  <tr>
   <td>
     <div class="container box">
		<img src="啊啊.jpg"/>
     </div>
   </td>
  </tr>
</table>

</body>

css.css:

	.container{
		margin: 6px;padding:5px;
		border: 1px solid #D0D0D0;
		-webkit-box-shadow: 0 0 8px #D0D0D0;
		background:white;
	}

	.box{ width:50px; border:1px #000 solid;}
	img{ max-width:50px!important; height:auto!important; width:expression(this.width > 50 ? "50px" : this.width)!important;}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值