我想把我的html頁面分成兩列。一列應該由圖像和其他文本填充。我面臨以下問題:如何將html頁分成兩列?
列不佔據確切的50-50寬度。
圖像開始前從左邊緣有一個薄邊。需要刪除該保證金。
這兩列之間存在巨大差距。
這將是真正有用的,如果有人可以看看這個代碼,並建議更正:
.container img {
width: 100%;
}
.thin-black-border {
border-color: black;
border-width: 05px;
border-style: solid;
}
.header {
font: 200 80px'Oleo Script', Helvetica, sans-serif;
color: #2b2b2b;
text-shadow: 4px 4px 0px rgba(0, 0, 0, 0.1);
}
<link href='http://fonts.googleapis.com/css?family=Oleo+Script' rel='stylesheet' type='text/css'>
<div style="width:100%; height: 100px;background-color:green" class="bg-faded">
<!-- Main Div -->
<h1 class="text-center header">Madhubala</h1>
</div>
<div style="float:left;width:50%;" class="container">
<img src="https://nehamalude.files.wordpress.com/2011/02/madhubala.jpg" class="thin-black-border" />
</div>
<div style="float:left; width:50%; background-color:red; ">
Right
</div>
使用引導:https://www.w3schools.com/bootstrap/bootstrap_grid_stacked_to_horizontal.asp –
你不需要使用引導來創建2列布局。 – zik