2017-05-07 18 views
1

私のコンテンツの後に私のウェブページはこの余分な白いスペースをすべて持っています。私のコードをあなたのIDEに貼り付けると、それは素晴らしいと思う!私はいくつかのことをしようとすると、ページの全体のコンテンツを分割し、底にいくつかのパディングと余白を設定しますが、私はそれを得ることができません!余分なHTML5空白の領域のホワイトスペーシング

<!DOCTYPE html> 
<html> 
<head> 
<link rel="stylesheet" type="text/css" href="css/about.css"> 
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet"> 
    <title>Halong Bay</title> 
</head> 
<body> 

    <nav class="navbar"> 
      <ul> 
       <li><a href="index-bay.html">Home</a></li>  
       <li><a href="about.html">About</a></li> 
       <li><a href="gallery.html">Gallery</a></li> 
       <li><a href="map.html">Map</a></li> 
       <li><a href="tables.html">Table</a></li> 
       <li><a href="#">Contact</a></li> 
      </ul> 
     </nav> 

    <section class="intro"> 
     <div class="inner"> 
      <div class="content"> 
       <h1>About Halong Bay</h1> 
       <a class="btn" href="#link"> get started </a> 
       <a class="btn" href="index-bay.html"> Back to Home </a> 
      </div> 
     </div> 
    </section> 
    <article> 
    <h1>Halong Bay</h1> 
    <p id="link"> 
     Ha Long Bay, is in Northeast Vietnam. It is known for its beatiful emerald waters and thousands of towering green limestone islands. It is topped by rainforests, junk boat tours, and sea kayak expeditions. The boat tours takes it visitors past islands named for their shapes, including Stone Dog, and Teapot island. The region is popular for scuba diving, rock climbing, and hiking. It is a really beatiful place to visit and has some most fasinating species of animals that live in this bay. 
    </p> 
    </article> 
    <div id="history"> 
    <h1>History of Ha Long Bay</h1> 
    <p> 
     For hundreds of years Halong bay has been an important culture and history of Vietnam. Halong bay also known as Vinh Ha Long, means "Bay of the Descending Dragon". There are approximately 1,969 small islands in this bay. All compromised of differnt sizes and form. These islands have intrigues and amazed locals for hundreds of years. There are over 200 species of fish and over 250 species of mulluks in the water. 
    </p> 
    </div> 


</body> 
</html> 

html, body { 
    margin: 0; 
    padding: 0; 
    height: 100%; 
    width: 100%; 


} 

.intro { 
    height: 100%; 
    width: 100%; 
    margin: auto; 
    background: url(http://greenhillholidays.info/files/uploads/2016/04/Vietnam-HD-Wallpapers.jpg); 
    background-size: cover; 
    display: table; 
} 

.intro .inner { 
    display: table-cell; 
    vertical-align: middle; 
    width: 100%; 
    max-width: none; 
} 

.content { 
    text-align: center; 
    max-width: 500px; 
    margin: 0 auto; 
} 

.content h1 { 
    font-family: 'Raleway'; 
    color: #f9f3f4; 
    text-shadow: 0px 0px 300px #000; 
    font-size: 500%; 
} 

.btn { 
    border-radius: 9px; 
    font-family: 'Raleway'; 
    color: white; 
    font-size: 135%; 
    padding: 10px 20px; 
    border: solid #036AB1; 
    text-transform: uppercase; 
    text-decoration: none; 
    margin-right: 20px; 
    font-weight: bold; 
} 

.btn:hover { 
    color: #fff; 
    border: solid #fff 3px; 
} 

p { 
    font-size: 160%; 
    line-height: 200%; 
    margin: 3%; 
    font-family: 'Raleway'; 
    padding: 200px; 
} 


nav ul li { 
    position: relative; 
    color: red; 
    font-size: 24px; 
    display: inline-block; 
    text-align: right; 
    margin-right: 40px; 
    text-decoration: none; 
    text-transform: uppercase; 
    font-family: 'Raleway'; 
    font-weight: 900; 



} 

nav ul li a { 
    color: black; 
    text-decoration: none; 


} 

nav ul li a:hover { 
    color: blue; 

} 

.navbar { 
    color: black; 
    text-align: center; 


} 

a.btn { 
    font-weight: 950; 
} 

#link { 
    position: relative; 
    bottom: 100px; 

} 

p:first-letter { 
    font-size: 200%; 
} 





article { 
    padding: 50px; 
} 

#top1 { 

    font-size: 30px; 
    text-align: center; 

} 

article h1 { 
    font-size: 40px; 
    text-align: center; 
} 



#history h1 { 
    font-size: 50px; 
    text-align: center; 
    position: relative; 
    bottom: 300px; 
} 


#history p { 
    position: relative; 
    bottom: 500px; 
} 

答えて

0

私はあなたがその大きな空きスペースを持っていた理由は、これら二つのことが問題だった考え出し:bottomワット/パディングとの相対位置を使用して

  • 200pxパディング。

実際には、その要素に多くのパディングを使用しないでください。私は私のシステムでコードをチェックしたとき、私は問題は、パディングとマージンの来ていることに気づいた

html, 
 
body { 
 
    margin: 0; 
 
    padding: 0; 
 
    height: 100%; 
 
    width: 100%; 
 
} 
 

 
.intro { 
 
    height: 100%; 
 
    width: 100%; 
 
    margin: auto; 
 
    background: url(http://greenhillholidays.info/files/uploads/2016/04/Vietnam-HD-Wallpapers.jpg); 
 
    background-size: cover; 
 
    display: table; 
 
} 
 

 
.intro .inner { 
 
    display: table-cell; 
 
    vertical-align: middle; 
 
    width: 100%; 
 
    max-width: none; 
 
} 
 

 
.content { 
 
    text-align: center; 
 
    max-width: 500px; 
 
    margin: 0 auto; 
 
} 
 

 
.content h1 { 
 
    font-family: 'Raleway'; 
 
    color: #f9f3f4; 
 
    text-shadow: 0px 0px 300px #000; 
 
    font-size: 500%; 
 
} 
 

 
.btn { 
 
    border-radius: 9px; 
 
    font-family: 'Raleway'; 
 
    color: white; 
 
    font-size: 135%; 
 
    padding: 10px 20px; 
 
    border: solid #036AB1; 
 
    text-transform: uppercase; 
 
    text-decoration: none; 
 
    margin-right: 20px; 
 
    font-weight: bold; 
 
} 
 

 
.btn:hover { 
 
    color: #fff; 
 
    border: solid #fff 3px; 
 
} 
 

 
p { 
 
    font-size: 160%; 
 
    line-height: 200%; 
 
    margin: 3%; 
 
    font-family: 'Raleway'; 
 
    padding: 20px 200px; 
 
} 
 

 
nav ul li { 
 
    position: relative; 
 
    color: red; 
 
    font-size: 24px; 
 
    display: inline-block; 
 
    text-align: right; 
 
    margin-right: 40px; 
 
    text-decoration: none; 
 
    text-transform: uppercase; 
 
    font-family: 'Raleway'; 
 
    font-weight: 900; 
 
} 
 

 
nav ul li a { 
 
    color: black; 
 
    text-decoration: none; 
 
} 
 

 
nav ul li a:hover { 
 
    color: blue; 
 
} 
 

 
.navbar { 
 
    color: black; 
 
    text-align: center; 
 
} 
 

 
a.btn { 
 
    font-weight: 950; 
 
} 
 

 
#link { 
 
    position: relative; 
 
} 
 

 
p:first-letter { 
 
    font-size: 200%; 
 
} 
 

 
article { 
 
    padding: 50px; 
 
} 
 

 
#top1 { 
 
    font-size: 30px; 
 
    text-align: center; 
 
} 
 

 
article h1 { 
 
    font-size: 40px; 
 
    text-align: center; 
 
} 
 

 
#history h1 { 
 
    font-size: 50px; 
 
    text-align: center; 
 
    position: relative; 
 
} 
 

 
#history p { 
 
    position: relative; 
 
}
<html> 
 

 
<head> 
 
    <link rel="stylesheet" type="text/css" href="css/about.css"> 
 
    <link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet"> 
 
    <title>Halong Bay</title> 
 
</head> 
 

 
<body> 
 

 
    <nav class="navbar"> 
 
    <ul> 
 
     <li><a href="index-bay.html">Home</a></li> 
 
     <li><a href="about.html">About</a></li> 
 
     <li><a href="gallery.html">Gallery</a></li> 
 
     <li><a href="map.html">Map</a></li> 
 
     <li><a href="tables.html">Table</a></li> 
 
     <li><a href="#">Contact</a></li> 
 
    </ul> 
 
    </nav> 
 

 
    <section class="intro"> 
 
    <div class="inner"> 
 
     <div class="content"> 
 
     <h1>About Halong Bay</h1> 
 
     <a class="btn" href="#link"> get started </a> 
 
     <a class="btn" href="index-bay.html"> Back to Home </a> 
 
     </div> 
 
    </div> 
 
    </section> 
 
    <article> 
 
    <h1>Halong Bay</h1> 
 
    <p id="link"> 
 
     Ha Long Bay, is in Northeast Vietnam. It is known for its beatiful emerald waters and thousands of towering green limestone islands. It is topped by rainforests, junk boat tours, and sea kayak expeditions. The boat tours takes it visitors past islands 
 
     named for their shapes, including Stone Dog, and Teapot island. The region is popular for scuba diving, rock climbing, and hiking. It is a really beatiful place to visit and has some most fasinating species of animals that live in this bay. 
 
    </p> 
 
    </article> 
 
    <div id="history"> 
 
    <h1>History of Ha Long Bay</h1> 
 
    <p> 
 
     For hundreds of years Halong bay has been an important culture and history of Vietnam. Halong bay also known as Vinh Ha Long, means "Bay of the Descending Dragon". There are approximately 1,969 small islands in this bay. All compromised of differnt sizes 
 
     and form. These islands have intrigues and amazed locals for hundreds of years. There are over 200 species of fish and over 250 species of mulluks in the water. 
 
    </p> 
 
    </div> 
 

 

 

 
</body> 
 

 
</html>

+0

あなたは絶対に正しくありました。私は事故でそのパッドを実際に置いていました。 200のパディングは、どのHTML要素に対してもあまりにも多くあります。私は質問がありましたが、なぜあなたは底に位置関係を使用することが悪いことを明確にすることができますか?私が通常、上、左、右、下の少しずつ要素を押したり引っ張ったりすると、私はそうする前にそれを相対的な位置づけにしていますか?それは間違っているのですか、それとも良い方法がありますか?前もって感謝します。 –

+0

それはそれが_bad_だったとは言いませんでした。この場合のボトムの使用は、スクリーンの下端に基づいており、下の要素に基づいていないため、あまり良い考えではありませんでした。代わりにmargin-bottomを使用してください。 – suufi

+0

ああありがとう、ありがとう、私はそれを感謝します! –

0

:ここ

私は推測しているものを、だ、それは次のようになります。あなたのCSSの設定。 私はあなたのCSSを少し変更しました。それを試しても問題が残っていることを私に教えてください。

html, body { 
    margin: 0; 
    padding: 0; 
    height: 100%; 
    width: 100%; 


} 

.intro { 
    height: 100%; 
    width: 100%; 
    margin: auto; 
    background: url(http://greenhillholidays.info/files/uploads/2016/04/Vietnam-HD-Wallpapers.jpg); 
    background-size: cover; 
    display: table; 
} 

.intro .inner { 
    display: table-cell; 
    vertical-align: middle; 
    width: 100%; 
    max-width: none; 
} 

.content { 
    text-align: center; 
    max-width: 500px; 
    margin: 0 auto; 
} 

.content h1 { 
    font-family: 'Raleway'; 
    color: #f9f3f4; 
    text-shadow: 0px 0px 300px #000; 
    font-size: 500%; 
} 

.btn { 
    border-radius: 9px; 
    font-family: 'Raleway'; 
    color: white; 
    font-size: 135%; 
    padding: 10px 20px; 
    border: solid #036AB1; 
    text-transform: uppercase; 
    text-decoration: none; 
    margin-right: 20px; 
    font-weight: bold; 
} 

.btn:hover { 
    color: #fff; 
    border: solid #fff 3px; 
} 

p { 
    font-size: 160%; 
    line-height: 200%; 
    margin: 3%; 
    font-family: 'Raleway'; 
    padding: 200px; 
} 


nav ul li { 
    position: relative; 
    color: red; 
    font-size: 24px; 
    display: inline-block; 
    text-align: right; 
    margin-right: 40px; 
    text-decoration: none; 
    text-transform: uppercase; 
    font-family: 'Raleway'; 
    font-weight: 900; 



} 

nav ul li a { 
    color: black; 
    text-decoration: none; 


} 

nav ul li a:hover { 
    color: blue; 

} 

.navbar { 
    color: black; 
    text-align: center; 


} 

a.btn { 
    font-weight: 950; 
} 

#link { 
    position: relative; 
    bottom: 100px; 
    padding-bottom:0px; 
    margin-bottom:0px; 
    margin-top: 0; 
    padding-top: 100px; 
} 

p:first-letter { 
    font-size: 200%; 
} 





article { 
    padding-top: 50px; 
    padding-left: 50px; 
    padding-right: 50px; 
    padding-bottom: 0px; 
} 

#top1 { 

    font-size: 30px; 
    text-align: center; 

} 

article h1 { 
    font-size: 40px; 
    text-align: center; 
} 



#history h1 { 
    font-size: 50px; 
    text-align: center; 
    position: relative; 
} 


#history p { 
    position: relative; 
    padding-bottom: 0px; 
    padding-top: 0px; 
    margin-bottom: 0; 
    margin-top: 0;  
} 
関連する問題