就像這個問題所說的,我不能將任何東西都浮在水底......我嘗試了float:absolute,它表明了這一點。應該有5個不同的盒子,但它只顯示其中一個。這是我的代碼:如何將div浮動到頁面底部?
html,
body {
height: 100%;
}
#one,#two,#three,#four,#five {
margin:0;
padding:0;
float:left;
display:inline-block;
height:50%;
width:20%;
bottom:0;
right:0;
left:0;
position:absolute;
}
div {
margin:-2px;
padding:-2px;
}
#container {
display: inline-block;
width: 100%;
height: 100%;
position: relative;
}
#one {
background-color: blue;
}
#two {
background-color: green;
}
#three {
background-color: yellow;
}
#four {
background-color: orange;
}
#five {
background-color: red;
}
<div id="one">
</div>
<div id="two">
</div>
<div id="three">
</div>
<div id="four">
</div>
<div id="five">
感謝提前:)
它們堆疊在彼此之上... –
也許你應該讀一下浮子實際上做了什麼? https://developer.mozilla.org/en/docs/Web/CSS/float - 「bottom」和「absolute」不是它接受的值。 – Quentin