<body οnclick="bodyclick()" leftMargin=200 topMargin=120 rightMargin=200>
<div id="mainDiv" style="height:auto;left:0px;right:0px;background-color:#99FF00">
<table>
<tr>
<td>
<input type="text" value="zheshi">
</td>
</tr>
<tr>
</tr>
</table>
</div>
</body>
效果:
[img]http://dl2.iteye.com/upload/attachment/0089/0625/78da03fb-840a-3788-8be5-9bf6c727fa6c.jpg[/img]
代码:
<div id="mainDiv" style="height:auto;left:0px;right:0px;background-color:#99FF00">
<input type="text" value="zheshi">
</div>
效果:
[img]http://dl2.iteye.com/upload/attachment/0089/0627/337813ac-acb1-31d7-9e50-fcc868924f43.jpg[/img]
div里style的height属性值auto表示高度自动,但是最终排版展示会根据里面的元素进行自动调整
<div id="mainDiv" style="height:auto;left:0px;right:0px;background-color:#99FF00">
<table>
<tr>
<td>
<input type="text" value="zheshi">
</td>
</tr>
<tr>
</tr>
</table>
</div>
</body>
效果:
[img]http://dl2.iteye.com/upload/attachment/0089/0625/78da03fb-840a-3788-8be5-9bf6c727fa6c.jpg[/img]
代码:
<div id="mainDiv" style="height:auto;left:0px;right:0px;background-color:#99FF00">
<input type="text" value="zheshi">
</div>
效果:
[img]http://dl2.iteye.com/upload/attachment/0089/0627/337813ac-acb1-31d7-9e50-fcc868924f43.jpg[/img]
div里style的height属性值auto表示高度自动,但是最终排版展示会根据里面的元素进行自动调整