は、ここに私がいる問題のスクリーンショットですnavbar。私はマージンとパディングを0にしようとしましたが、動作していません。どんな助けもありがとう。ここでは、ナビゲーションバー上の空白を削除する方法
はhtmlです:
html,
body {
margin: 0;
padding: 0;
height: 100%;
background-image: url("images/bg.jpg");
background-repeat: no-repeat;
background-position: center top;
font-family: Times New Roman;
}
header {
clear: both;
text-align: center;
}
#header img {
height: 40%;
width: 40%;
}
#wrap {
width: 1000px;
margin: auto;
padding: auto;
overflow: auto;
}
ul {
padding: 0;
}
nav ul {
margin: auto;
padding: auto;
list-style-type: none;
background-color: #009BB2;
}
nav li {
display: inline;
padding-left: 10px;
}
nav a {
text-decoration: none;
padding: 5px;
font-family: Times New Roman;
font-size: 25px;
color: maroon;
}
nav a:hover {
color: blue;
}
img.size {
height: 15%;
width: 15%;
padding: 5px;
}
section h1 {
text-align: center;
}
figure {
float: right;
overflow: hidden;
margin: 0px;
padding: 0px;
}
<div id="wrap">
<header>
<div id="header">
<img src="logo.png" alt="The Seasons" />
</div>
<nav>
<ul>
<li><a href="">Fall</a></li>
<li><a href="">Spring</a></li>
<li><a href="">Summer</a></li>
<li><a href="">Winter</a></li>
<li><a href="">Home</a></li>
</ul>
</nav>
</header>
<section>
<h1>The Four Seasons of the Earth</h1>
<figure class="fig">
<img class="size" src="images/fall_front.png" alt="Fall" />
</figure>
<figure class="fig">
<img class="size" src="images/winter_front.png" alt="Winter" />
</figure>
<figure class="fig">
<img class="size" src="images/spring_front.png" alt="Spring" />
</figure>
<figure class="fig">
<img class="size" src="images/summer_front.png" alt="Summer" />
</figure>
</section>
</div>
へ
変更
#wrap{width: 1000px}
? –問題は表示されませんか? navは私のために '#wrap'の遠端まで伸びます。あなたのコードはレイアウトの問題を正確に再現しますか? http://codepen.io/anon/pen/JWGOpR –
私はJeff Millerが正しい答えを持っていると信じていますが、navの背景の幅を短くするか、navを100%にしたいかを明確にしたいかもしれません。幅 – Klav