圖像已經在背景圖像的上面這一事實不應該改變任何東西。
有兩種使用純CSS的方法,第一種是使用絕對座標。 例如
#img {
left: 40px;
top: 40px;
height: 80px;
width: 80px;
}
#textblock {
left: 140px;
top: 40px;
width: 200px;
}
第二個是使用相對定位。這將根據屏幕大小而改變。
#img {
left: 10%;
top: 10%;
height: 5%;
width: 5%;
}
#textblock {
left: 30%;
top: 10%;
width: 60%;
}
注意:這兩個示例都假定您的文本塊具有id = textblock,並且您的圖像具有id = img。
注意:如果您在使用「分層」時遇到問題,請參閱「z-index」CSS屬性。
編輯:使用您的更新代碼並利用內聯樣式中的width屬性,可以簡單地將left屬性添加到width屬性以獲取文本的位置, t重疊文本。
<img src="https://www.vizsy.com/public/images/brandow/Landing_Page_background.png" style="position: relative; top: 0; left: 0;"/>
<img src="http://www.psychiatry.emory.edu/images/cloud2.png" style="position: absolute; top: 30px; left: 70px; width:200px"/>
<p style="position: absolute; top: 30px; left: 270px; right:20px">some text</p>
通知段落元件左屬性如何爲=(IMG左)+(IMG寬度)。這意味着它將爲圖片旁邊的段落提供一個起點,使它們不會重疊。
一些代碼將是有益的....但你嘗試過使用[引導](http://getbootstrap.com/)來構建一個網格,握住你的內容是什麼? – matthewelsom