問題是#lesson
容器不適合內#container
。我怎樣才能讓只有3個容器適合一列? CSS忍者,我需要你的幫助:)容器內不適合大
我的CSS:
#container
- 主容器,#first
- 綠色容器,#lesson
- 灰色的div。
#container {
position: relative;
top: 70px;
left: 80px;
width:100%;
height:80%;
}
#first {
background-color: #A1D490;
width:45%;
height:100%;
float:left;
border:2px solid black;
margin: 5px;
}
.lesson {
position: relative;
background-color: #DCDDDE;
margin:10px;
width:200px;
height:200px;
border:1px solid;
text-align: center;
}
HTML:
<div id="container">
<div id="first">
<tpl for=".">
<div class="lesson"; >
<p class="txt"><b>Lesson:</b> {lesson} </p>
<p class="txt"><b>Score:</b> {score}</p>
</div>
</tpl>
</div>
<div id="second">
</div>
</div>
它爲我工作。 [小提琴](http://jsfiddle.net/8ms92uu9/1/) – CodeRomeos
首先,你有沒有理由使用'position:relative'和'float:left'? –
也是因爲你已經漂浮了##第一個。使用清除:既清除浮游物。 – CodeRomeos