一定有什麼東西非常簡單,我搞亂了,但我不能告訴它是什麼。兩列顯示正確分隔,圖像位於正確的位置(我已將圖像拖放到VS2012中的CSS代碼中以驗證路徑是否正確。)背景圖像應該顯示左列是一個棕褐色和主要內容列爲白色。相反,整個頁面的背景是白色的。無法獲取背景圖像與人造列方法可見
下面是HTML:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="TwoColumnStyle.css" rel="stylesheet" />
<title>Two-column layout</title>
</head>
<body>
<div id="wrapper">
<div id="leftColumn">
<ul>
<li>First</li>
<li>Second</li>
<li>Third</li>
</ul>
</div>
<div id="mainContent">
<h1>This is the header</h1>
<h2>Content1</h2>
<p>This is the first paragraph. La de daa.</p>
<p>This is the second paragraph. Doo be doo.</p>
<h2>Content2</h2>
<p>This is the third paragraph. Bow chik a wow wow.</p>
</div>
</div>
</body>
</html>
這裏是CSS:
body {
width: 960px;
margin-left: auto;
margin-right: auto;
}
#wrapper { background-image: url(images/col_bg.png);
background-repeat: repeat-y;
background-position: left top; }
#leftColumn {
width: 100px;
float: left;
}
#mainContent {
width: 860px;
float: right;
}
這裏是將圖像的絕對路徑,但明顯高於CSS是相對路徑:
http://localhost:10525/layouts1/images/col_bg.png
圖片是960px x 1px。
任何線索,我做錯了什麼在這裏?我試圖用DIV做一些實驗用的基本佈局,並從我在網上看到的信息,這是它究竟應該怎麼寫(通過CSS失蹤手冊第2版和在線資源。)
試過了,它有效。溢出不是我平常的goto風格規則,但是,我剛剛學到了一些東西。謝謝! – nocturns2