我已經通過論壇,似乎已嘗試所有有關div佈局的建議。我試圖獲得兩行元素,如下所示: 第1行 - 數字>圖像>文本。 第2行 - (空格將第二行向右移動與上圖相同數量的像素)> Number> Image> Text。爲什麼我的Div元素不會排隊?
這是我的代碼,我試過到目前爲止:
@import url(http://fonts.googleapis.com/css?family=Londrina+Sketch);
body {
background-color: #f3eedd;
width: 750px;
overflow: scroll;
overflow-x: hidden;
}
h1 {
font-family: 'Londrina Sketch', cursive;
color: #c13e18;
font-size: 50px;
text-align: center;
margin: 0px 30px 0px 30px;
}
h2 {
font-size: 20px;
color: #c13e18;
margin: 10px 30px 10px 30px;
}
h3 {
font-size: 20px;
margin: 30px 30px 0px 30px;
}
h4 {
text-align: center;
}
p {
font-size: 20px;
margin: 0px 30px 0px 30px;
}
.choose {}
.number {
display:inline-block;
float:left;
}
.choose-image {
display: inline-block;
float: left;
}
.choose-text {
display: inline-block;
vertical-align: top;
float: left;
}
.customise {}
.empty-left {
display: inline-block;
width: 300px;
overflow: hidden;
}
.customise-image {
display: inline-block;
}
.customise-text {
display: inline-block;
vertical-align: top;
}
<h1>FROM BEGINNING TO END</h1>
<hr>
<h2>How many? What size? How old? When and why? How much?
If you’d like to learn more about group sizes, room dimensions, prices & age limits … this section must have your answer! However if you can’t find it, please don’t hesitate to drop us a line!</h2>
<hr>
<!-- choose -->
<div class="choose">
<div class="number">
<h4>1</h4>
</div>
<div class="choose-image">
<img src="http://www.challenge-the-box.com/wp-content/uploads/choose.png" alt="" />
</div>
<div class="choose-text">Choose text content goes here</div>
</div>
<div class="customise">
<div class="empty-left"></div>
<div class="number">
<h4>2</h4>
</div>
<div class="customise-image">
<img src="http://www.challenge-the-box.com/wp-content/uploads/customise.png" alt="" />
</div>
<div class="customise-text">Customise text content goes here</div>
</div>
謝謝!
使用float和寬度也。 –
同時改變({number number class。 –
Float no !!!內聯塊是!它不是浮動元素,它是一個內聯塊元素 –