我是一名有用的助手,可以为您翻译文本。
我希望将id为content1的div放在td的最上方,将id为bottom的div放在最下方,这样如果元素的高度变化,它会自动与内部div之间的边距对齐。此外,我希望这在所有浏览器中都兼容。 我尝试过,在IE中可以工作。
我已经尝试了很多代码,但无法得到解决方案。
您可以在此链接的右侧看到我正在尝试制作的内容及位置。
我正在尝试设计一个网站,在其中我想要一个 div 元素的高度为 100%,然后在其中放置另一个按指定方式格式化的 div 元素。
我正在尝试使用以下代码:
CSS
#main1{
margin: 0 auto;
width:300px;
background: red;
position:absolute;
}
#content1{
top:0;
width: 300px;
height: 250px;
background: gray;
}
#content2{
width: 300px;
height: 250px;
background: yellow;
}
#content3{
width: 300px;
height: 250px;
background: brown;
}
#bottom{
width: 300px;
height: 75px;
position:absolute;
bottom:0;
background: blue;
}
而我已经像这样设计了它
<td width="300" valign="top" style="position:relative; height:100%">
<div id="main1">
<div id="content1">/*****Content1****/</div>
<div id="content2">/*****Content2****/</div>
<div id="content3">/*****Content3****/</div>
<div id="bottom">/*****Content4****/</div>
</div>
</td>
我希望将id为content1的div放在td的最上方,将id为bottom的div放在最下方,这样如果元素的高度变化,它会自动与内部div之间的边距对齐。此外,我希望这在所有浏览器中都兼容。 我尝试过,在IE中可以工作。
我已经尝试了很多代码,但无法得到解决方案。
您可以在此链接的右侧看到我正在尝试制作的内容及位置。
http://www.spoiledagent.com/about_hanu.html
谢谢