所以我想設計我的網站,並且我的導航欄和圖像之間有這麼大的白色空白。我在這裏做錯了什麼地方?HTML&CSS中的巨大白色空白
另外側面說明:有誰知道我怎麼可以「框」我的整個頁面,讓兩邊都有空白的空間?
HTML:
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<title>Design</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="box">
<div id="header">
<br />
<div style="margin-left: 1250px;">
<input id="sweBtn" type="button" value="SVENSKA" />
<input id="engBtn" type="button" value="ENGLISH" />
<input id="searchTxt" type="text" />
<input id="searchBtn" type="button" value="SÖK" />
</div>
<br />
</div>
<div class="col-sm-4 text-left" id="imgTitle">
<h1>Header</h1>
<p>Text</p>
</div>
<div class="col-sm-4">
<img id="imgHeader" src="~/img/Header.png" />
</div>
<div id="navBar">
<ul>
<li><a class="active" href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
</div>
</div>
</div>
</div>
<footer></footer>
</body>
</html>
<link href="~/Content/custom.css" rel="stylesheet" />
CSS
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #111;
}
#header {
background-color: #503F31;
color: white;
padding: 30px;
}
#sweBtn {
font-family: 'Times New Roman';
background-color: Transparent;
color: grey;
}
#engBtn {
font-family: 'Times New Roman';
background-color: Transparent;
color: gold;
}
#searchTxt {
background-color: grey;
border-color: grey;
}
#searchBtn {
font-family: 'Times New Roman';
background-color: Transparent;
color: gold;
}
#imgTitle {
position: absolute;
}
#imgHeader {
height: 1000px;
width: 3400px;
}
#footer {
background-color: grey;
color: white;
padding-bottom: -250px;
}
由於在談論一位圖像下方的縫隙,如果你的代碼示例包含一個鏈接,這將方便您的圖像或更好,如果你可以提供一個像jsFiddle的代碼示例。 這樣我就彈出了一個可能的答案 – UntitledGraphic
您是否使用Twitter Bootstrap? – Jeff