11问答网
所有问题
html中怎样把背景图片居中,不要css的
如题所述
举报该问题
推荐答案 2012-12-01
背景图片不用CSS控制不了 要是插入的图片用table也可以居中
<table width="900" height="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="middle"<img src="/Images/2.gif" width="800" height="230" /></td>
</tr>
</table>
用样式是这样的
<style>
.main{width:980px; height:500px; margin:0 auto; background:url(Images/2.gif) no-repeat center; overflow:hidden;}
</style>
</head>
<body>
<div class="main">
</div>
温馨提示:答案为网友推荐,仅供参考
当前网址:
http://11.wendadaohang.com/zd/2q8S2PSF4.html
其他回答
第1个回答 2012-12-03
<script type="text/javascript">
document.body.style.background="#FFCC80 url(img/kenan.jpg) no-repeat top center";
</script>
#ffcc80是背景色,url(img/kennan.jpg)是图片地址,no-repeat top center是图片不重复居中来自:求助得到的回答
第1个回答 2012-12-03
无语,背景图片居然不许用css,那你可以写更复杂的javascript也是可以的,如果你会的话。
追问
没办法啊,作业要求
第2个回答 2012-12-02
在标签前面后面加入<center></center>
相似回答
html中怎样把背景图片居中,不要css的
答:
背景图片不
用
CSS
控制不了 要是插入的图片用table也可以
居中
<table width="900" height="500" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center" valign="middle"<img src="/Images/2.gif" width="800" height="230" /></td> </tr> </table> 用样式是这样的...
大家正在搜
相关问题
在html代码中怎么让背景图片居中
css如何使背景图片水平居中
在html中怎样使背景图片拉伸,平铺,居中?
在css中如何让背景图片居中 并且不平铺
CSS中背景图怎么居中显示啊
css,如何使整个页面背景图片居中?
CSS中,背景图片如何居中?HTML的,另外不支持直接在图片...
为什么显示的背景图片是平铺的。怎么居中,能在不用css的情况...