2016-10-06 2 views
0

プレビュー:不要な空白

Preview

どのように私は、ヘッダーからこのホワイトスペースを削除することができますか?私はヘッダーの詰め物で演奏しなかった。

ヘッダーとフッターのセクションがあります。また、私はHeader、Body、Footerを含むすべてのセクションを持っています。ヘッダー内のこの空白の原因は何ですか?どうすれば削除できますか?

私のCSSコード:

*{ 
    font-family: sans-serif; 
} 
h2.header_headings{ 
    font-size: 45px; 
    text-indent: 10px; 
    line-height: 1px; 
} 
h3.header_headings{ 
    font-size: 20px; 
    text-indent: 25px; 
    line-height: 1px; 
} 
h1.body_headings{ 
    font-size: 27px; 
} 
h1.body_headings:first-letter{ 
    font-size: 200%; 
} 
img{ 
    float: left; 
} 
p{ 
    font-family: tahoma; 
} 
ul 
{ 
    font-weight: bold; 
    font-size: 18px; 
} 
a 
{ 
    color: orange; 
} 
a:hover 
{ 
    color: green; 
} 
li 
{ 
    margin: 5px; 
} 
footer{ 
    font-size: 15px; 
    text-align: center; 
} 
#copyright{ 
    vertical-align: middle; 
} 
#body{ 

    width: 800px; 
    background-color: white; 
    border-width: thick; 
    border-color: black; 
    border-style: solid; 
    margin: auto; 
    box-shadow: 0 0 30px #000000; 
} 
body{ 
    background-image: url("../images/bats.gif"); 
    background-repeat: repeat; 
} 
#header{ 
    border-bottom: 2px solid black; 
    background: orange; /* For browsers that do not support gradients */ 
    background: -webkit-linear-gradient(45deg, white, orange 75%, black); /* For Safari 5.1 to 6.0 */ 
    background: -o-linear-gradient(45deg, white, orange 75%, black); /* For Opera 11.1 to 12.0 */ 
    background: -moz-linear-gradient(45deg, white, orange 75%, black); /* For Firefox 3.6 to 15 */ 
    background: linear-gradient(45deg, white, orange 75%, black); /* Standard syntax */ 
} 
#footer{ 
    height: 50px; 
    border-top: 2px solid black; 
    background: orange; /* For browsers that do not support gradients */ 
    background: -webkit-linear-gradient(45deg, black, orange, white); /* For Safari 5.1 to 6.0 */ 
    background: -o-linear-gradient(45deg, black, orange, white); /* For Opera 11.1 to 12.0 */ 
    background: -moz-linear-gradient(45deg, black , orange, white); /* For Firefox 3.6 to 15 */ 
    background: linear-gradient(45deg, black, orange, white); /* Standard syntax */ 
} 

マイHTML5:

<!DOCTYPE html> 
<html lang="en"> 
<section id="body"> 
    <section id="header"> 
     <head> 
      <title>Halloween Store</title> 
      <meta charset = "UTF-8"> 
      <link rel="stylesheet" type="text/css" href="styles/main.css"/> 
      <link rel="stylesheet" type="text/css" href="styles/normalize.css"/> 
      <img src="images/pumpkin.gif" alt="Pumpkin Picture"> 
      <h2 class="header_headings">The Halloween Store</h2> 
      <h3 class="header_headings">For the little Goblin in all of us!</h3> 
     </head> 
    </section> 
    <body> 
     <h1 class="body_headings">Welcome to my site. Please come in and stay awhile.</h1> 
     <p>I started this web site because Halloween has always been my favorite holiday. But during the last year, I started selling some of my favorite Halloween products, and they've become quite a hit.</p> 
     <p>If you click on the Personal link, you can browse my favorite Halloween pictures, stories, and films. And if you join my email list, I will keep you up-to-date on all things Halloween.</p> 

     <h2 class="body_headings">Product categories</h2> 
     <ul> 
      <li><a href="products/props.html">Props</a></li> 
      <li><a href="products/Costumes.html">Costumes</a></li> 
      <li><a href="products/Special Effects.html">Special Effects</a></li> 
      <li><a href="products/Masks.html">Masks</a></li> 
     </ul> 
     <h2 class="body_headings">My guarantee</h2> 
     <p>If you aren't completely satisfied with everything you buy from my site, you can return it for a full refund. <b>No questions asked!</b></p> 
    </body> 
    <section id="footer"> 
     <footer> 
      <p id="copyright">&copy; 2016 Ben Murach</p> 
     </footer> 
    </section> 
</section> 
</html> 
+0

あなたはまた、HTMLコードを共有することはできますか? –

+0

@PraneshRavi申し訳ありません、私はHTML5コードを追加するのを忘れました。私は今それを追加しました。 – SaidAlbahri

答えて

1

ため20pxmargin-topを持っていた<h2>、でした。次は動作するはずです!

* { 
 
    font-family: sans-serif; 
 
} 
 
h2.header_headings { 
 
    font-size: 45px; 
 
    text-indent: 10px; 
 
    margin-top: 0; 
 
} 
 
h3.header_headings { 
 
    font-size: 20px; 
 
    text-indent: 25px; 
 
} 
 
h1.body_headings { 
 
    font-size: 27px; 
 
} 
 
h1.body_headings:first-letter { 
 
    font-size: 200%; 
 
} 
 
img { 
 
    float: left; 
 
} 
 
p { 
 
    font-family: tahoma; 
 
} 
 
ul { 
 
    font-weight: bold; 
 
    font-size: 18px; 
 
} 
 
a { 
 
    color: orange; 
 
} 
 
a:hover { 
 
    color: green; 
 
} 
 
li { 
 
    margin: 5px; 
 
} 
 
footer { 
 
    font-size: 15px; 
 
    text-align: center; 
 
} 
 
#copyright { 
 
    vertical-align: middle; 
 
} 
 
#body { 
 
    width: 800px; 
 
    background-color: white; 
 
    border-width: thick; 
 
    border-color: black; 
 
    border-style: solid; 
 
    margin: auto; 
 
    box-shadow: 0 0 30px #000000; 
 
} 
 
body { 
 
    background-image: url("../images/bats.gif"); 
 
    background-repeat: repeat; 
 
} 
 
#header { 
 
    border-bottom: 2px solid black; 
 
    background: orange; 
 
    /* For browsers that do not support gradients */ 
 
    background: -webkit-linear-gradient(45deg, white, orange 75%, black); 
 
    /* For Safari 5.1 to 6.0 */ 
 
    background: -o-linear-gradient(45deg, white, orange 75%, black); 
 
    /* For Opera 11.1 to 12.0 */ 
 
    background: -moz-linear-gradient(45deg, white, orange 75%, black); 
 
    /* For Firefox 3.6 to 15 */ 
 
    background: linear-gradient(45deg, white, orange 75%, black); 
 
    /* Standard syntax */ 
 
} 
 
#footer { 
 
    height: 50px; 
 
    border-top: 2px solid black; 
 
    background: orange; 
 
    /* For browsers that do not support gradients */ 
 
    background: -webkit-linear-gradient(45deg, black, orange, white); 
 
    /* For Safari 5.1 to 6.0 */ 
 
    background: -o-linear-gradient(45deg, black, orange, white); 
 
    /* For Opera 11.1 to 12.0 */ 
 
    background: -moz-linear-gradient(45deg, black, orange, white); 
 
    /* For Firefox 3.6 to 15 */ 
 
    background: linear-gradient(45deg, black, orange, white); 
 
    /* Standard syntax */ 
 
}
<!DOCTYPE html> 
 
<html lang="en"> 
 
<section id="body"> 
 
    <section id="header"> 
 

 
    <head> 
 
     <title>Halloween Store</title> 
 
     <meta charset="UTF-8"> 
 
     <link rel="stylesheet" type="text/css" href="styles/main.css" /> 
 
     <link rel="stylesheet" type="text/css" href="styles/normalize.css" /> 
 
     <img src="images/pumpkin.gif" alt="Pumpkin Picture"> 
 
     <h2 class="header_headings">The Halloween Store</h2> 
 
     <h3 class="header_headings">For the little Goblin in all of us!</h3> 
 
    </head> 
 
    </section> 
 

 
    <body> 
 
    <h1 class="body_headings">Welcome to my site. Please come in and stay awhile.</h1> 
 
    <p>I started this web site because Halloween has always been my favorite holiday. But during the last year, I started selling some of my favorite Halloween products, and they've become quite a hit.</p> 
 
    <p>If you click on the Personal link, you can browse my favorite Halloween pictures, stories, and films. And if you join my email list, I will keep you up-to-date on all things Halloween.</p> 
 

 
    <h2 class="body_headings">Product categories</h2> 
 
    <ul> 
 
     <li><a href="products/props.html">Props</a> 
 
     </li> 
 
     <li><a href="products/Costumes.html">Costumes</a> 
 
     </li> 
 
     <li><a href="products/Special Effects.html">Special Effects</a> 
 
     </li> 
 
     <li><a href="products/Masks.html">Masks</a> 
 
     </li> 
 
    </ul> 
 
    <h2 class="body_headings">My guarantee</h2> 
 
    <p>If you aren't completely satisfied with everything you buy from my site, you can return it for a full refund. <b>No questions asked!</b> 
 
    </p> 
 
    </body> 
 
    <section id="footer"> 
 
    <footer> 
 
     <p id="copyright">&copy; 2016 Ben Murach</p> 
 
    </footer> 
 
    </section> 
 
</section> 
 

 
</html>

関連する問題