我正在構建一個簡單的網站佈局。我在頂部有一個橫幅,底部有一個div box和一個圖像,都浮在左邊。我想讓標題橫幅右側的內聯女性形象。我嘗試過使用保證金,但它要麼使頁面脫離頁面,要麼不完全排列。如何使2個元素並排浮動,以排列在頂部的橫幅?
這裏的CSS:
.topbanner {
width:100%;
background-color:black;
padding:1%;
margin-top:1%;
}
#nav {
text-align:center;
}
.leftcolumn {
width:40%;
height:230px;
background-color: grey;
border: solid red 3px;
margin-top:2%;
float:left;
}
.leftcolumn p {
color:white;
text-align:center;
padding:13%;
font-style:italic;
font-size:20px;
}
.woman {
width:55%;
height:230px;
border: solid black 3px;
margin-top:2%;
float:left;
margin-left:4%;
這裏給codepen鏈接: http://codepen.io/Pea92/pen/JdpoqN
嘿謝謝,但這沒有奏效。圖像仍然沒有排列在頂部黑色橫幅的右側。 – psm93
等待什麼圖片? –
女人的形象,在頁面的右側。 – psm93