在为div设置背景图片时,如何根据百分比设置显示全图,而不是将多余的部分不显示(隐藏或剪切)?
1个回答
展开全部
这个仅IE有效
<!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; charset=gb2312" />
<title>css实现背景图片自适应大小</title>
</head>
<body>
<table width="200">
<tr> <td style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-zhidao.gif', sizingMethod='scale')">
<p>背景图片自适应大小</p>
<p> </p>
<p> </p>
<p> </p></td> </tr> </table>
<p>图片原始大小<img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-zhidao.gif" /></p>
</body>
</html>
<!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; charset=gb2312" />
<title>css实现背景图片自适应大小</title>
</head>
<body>
<table width="200">
<tr> <td style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-zhidao.gif', sizingMethod='scale')">
<p>背景图片自适应大小</p>
<p> </p>
<p> </p>
<p> </p></td> </tr> </table>
<p>图片原始大小<img src="https://gss0.bdstatic.com/70cFsjip0QIZ8tyhnq/img/logo-zhidao.gif" /></p>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询