我做了3種div,左邊2個,右邊1個使用float。現在我想自動,我的股利文本屬於我的img div但我無法得到它與20像素的工作。我在環視上找了一下,但找不到 的正確答案,大多數帖子都是2-3歲。我想知道有人能幫我嗎?如何在我的圖像div下獲取文本div?
HTML:
<body>
<div id="content">
<div class="b1"> </div>
<div class="b2"> </div>
<div class="b3"><p><h3>Wildlife</h3><br>Hello fellers how are you doing? In todays project I made something funny ore just not because this is just some random text</p></div>
</body>
CSS:
body {
background-color: #efede7;
line-height: 1.5;
}
#content{
background-color: #fff;
width: 962px;
margin: 0 auto;
}
.b1 { /*img div*/
background-color: #34495e;
height: 290px;
width: 470px;
float: left;
position: absolute;
}
.b2 { /*big img div*/
background-color: blue;
height: 600px;
width: 470px;
float: right;
}
.b3 { /* text div*/
background-color: #14495e;
color: #6d6f6f;
margin: 0;
height: 290px;
width: 470px;
padding: 4% 6% 0;
font-size: 1.0625em;
font-family: 'ProximaNova', sans-serif;
}
h3 {
margin: 0;
padding: 0;
font-family: 'Montserrat', sans-serif;
font-weight: bold;
color: #545454;
font-size: 1.25em;
letter-spacing: .05em;
text-transform: uppercase;
}
感謝您的幫助!
在你的問題,你可以通過他們的階級指的div所以我們知道DIV你想下其他的? – 2014-09-22 13:23:58
你好,克里斯托弗,我已經把它加入了小提琴中,但我也將其添加到問題中。 – FlatDesigner 2014-09-22 13:24:58
使用'位置:相對;'給b1,b2 [jsfiddle演示鏈接](http://jsfiddle.net/v8kfc38h/5/) – Farshad 2014-09-22 13:31:36