我試圖讓單列布局工作。該頁面有三個部分,一個標題區域,一個內容區域和一個頁腳區域。每個部分都有不同的背景圖像,我想跨越用戶屏幕上可視區域的整個寬度。如下面的代碼所示,我將這些部分拆分爲div,以便中間的內容區域隨着內容的增長而增長。CSS/HTML - 在瀏覽器調整大小的單列布局中溢出
我的問題是,由於我通過在瀏覽器(Chrome)中按ctrl +增加文本的大小,傳送帶部分溢出背景區域。下面給出調整前後的屏幕截圖。
HTML/CSS代碼模型很簡單,但我無法弄清楚爲什麼會發生溢出。有任何想法嗎?我是CSS/XHTML的新手 - 是否有任何其他標準方法來實現我正在嘗試完成的目標?
<html>
<head>
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="header_container">
<div id="header">
Header text
</div>
</div>
<div id="content_container">
<div id="content">
The content
<div id="carousel">
The carousel
</div>
<div id="clear_div">
</div>
</div>
</div>
<div id="footer_container">
<div id="footer">
The footer
</div>
</div>
</body>
</html>
下面是HTML的CSS:
#header_container {
width: 100%;
background-color: green;
}
#header {
width: 960px;
margin: auto;
}
#content_container {
width: 100%;
background-color: lightblue;
}
#content {
width: 960px;
margin: auto;
position: relative;
}
#carousel {
float: right;
width: 300px;
height: 200px;
background-color: red;
}
#clear_div {
clear: both;
}
#footer_container {
width: 100%;
background-color: lightgray;
clear: both;
}
#footer {
width: 960px;
margin: auto;
}
是的,就是這樣。謝謝! – ARV