0
我想讓兩個div相等高度 - 左和右的div。底部填充方法不適用於等高部分
我參考了以下文章,發現了底部填充方法。
- How do I achieve equal height divs (positioned side by side) with HTML/CSS ?
- CSS: How to make left float div to adjust height dynamically?
我想在我的網頁應用此概念;但它不能正常工作。在正確的div上面有不需要的空間。我們如何糾正它?
CODE
<!DOCTYPE html>
<style type="text/css">
.myContent {
width: 100%;
border: 2px solid violet;
min-width: 1210px;
}
.myHeader {
width: 100%;
/*width: 1200px;*/
clear: both;
background-color: #DFE8EF;
border: 1px solid red;
}
.leftPart {
border: 1px solid red;
width: 200px;
height: 200px;
float: left;
background-color: silver;
}
.rightPart {
border: 1px solid orange;
background-color: beige;
float: left;
min-width: 1000px;
/*
margin-bottom: -1000px;
padding-bottom: 1000px;
margin-right: -5000px;
padding-right: 5000px;
*/
}
</style>
<html>
<head>
<title>UpdateAccrualByItem</title>
<link href="Content/MasterLayoutStyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="body">
<div class="myContent">
<div class="myHeader">
<img src="/Images/logo_header.jpg" />
</div>
<div class="leftPart">
Menu
</div>
<div class="rightPart">
<h2>UpdateAccrualByItem</h2>
</div>
</div>
</div>
</body>
</html>
對於取消標記答案的道歉。我更新了這個問題。它不適用於該佈局。我需要有最小寬度。任何解決方案? – Lijo
因此,當窗口小於1200px時,右元素的最小寬度加上左元素的寬度,是否需要滾動條出現?你想隱藏窗外的內容嗎?你想要什麼樣的行爲? –
當窗口寬度小於1200像素時,需要隱藏項目「隱藏」。 – Lijo