2016-09-14 14 views
0

私のコードで助けてください。私は本当にそれを動作させることはできません。背景を完全にカバーするために背景の線色をどのように延長するかを理解するために4時間以上を費やしました。画像にはh1pというタグがありますが、コードでわかるように、画像の背景の半分だけを覆っています。背景:線形勾配(rgba(255,0,0,0.5))は、背景全体をカバーしていません

この問題を解決する方法を教えてください。

私には何が欠けていますか?

#bottom { 
 
    width: 100%; 
 
    height: 100%; 
 
    padding: 0px; 
 
    margin: 0px; 
 
    background-repeat: repeat; 
 
    background-size: cover; 
 
    background-position: fixed; 
 
    background: linear-gradient(rgba(255, 0, 0, 0.5), rgba(0, 255, 0, 0.5), rgba(0, 0, 255, 0.5)); 
 
} 
 
#khalifa { 
 
    height: 100%; 
 
    width: 50%; 
 
    float: left; 
 
} 
 
#bottom h1 { 
 
    text-align: center; 
 
    text-transform: uppercase; 
 
    font-weight: bold; 
 
    color: maroon; 
 
} 
 
#bottom p { 
 
    text-align: justify; 
 
    padding: 20px; 
 
    font-size: 18px; 
 
    font-family: sans-serif; 
 
} 
 
#bottom img { 
 
    width: 100%; 
 
    height: 700px; 
 
} 
 
#empire { 
 
    width: 50%; 
 
    float: left; 
 
}
<div id="bottom"> 
 
    <div> 
 
    <div id="khalifa"> 
 
     <a href="#"> 
 
     <img src="images/khalifa.jpg" alt=""> 
 
     </a> 
 
     <h1>Burj-Al-Khalifa</h1> 
 
     <p>The Burj Khalifa (Arabic: برج خليفة‎‎, Arabic for "Khalifa Tower"; pronounced English /ˈbɜːrdʒ kəˈliːfə/), known as the Burj Dubai before its inauguration, is a megatall skyscraper in Dubai, United Arab Emirates. It is the tallest structure in the 
 
     world, standing at 829.8 m (2,722 ft)</p> 
 
    </div> 
 

 
    <div id="empire"> 
 
     <a href="#"> 
 
     <img src="images/empire.jpg" alt=""> 
 
     </a> 
 
     <h1>Empire State</h1> 
 
     <p>The Burj Khalifa (Arabic: برج خليفة‎‎, Arabic for "Khalifa Tower"; pronounced English /ˈbɜːrdʒ kəˈliːfə/), known as the Burj Dubai before its inauguration, is a megatall skyscraper in Dubai, United Arab Emirates. It is the tallest structure in the 
 
     world, standing at 829.8 m (2,722 ft)</p> 
 
    </div> 
 

 
    <div id="royal"> 
 
     <a href="#"> 
 
     <img src="images/oneworld.jpg" alt=""> 
 
     </a> 
 
     <h1>Burj-Al-Khalifa</h1> 
 
     <p>The Burj Khalifa (Arabic: برج خليفة‎‎, Arabic for "Khalifa Tower"; pronounced English /ˈbɜːrdʒ kəˈliːfə/), known as the Burj Dubai before its inauguration, is a megatall skyscraper in Dubai, United Arab Emirates. It is the tallest structure in the 
 
     world, standing at 829.8 m (2,722 ft)</p> 
 
    </div> 
 

 
    <div id="empire"> 
 
     <a href="#"> 
 
     <img src="images/kingdom.jpg" alt=""> 
 
     </a> 
 
     <h1>Empire State</h1> 
 
     <p>The Burj Khalifa (Arabic: برج خليفة‎‎, Arabic for "Khalifa Tower"; pronounced English /ˈbɜːrdʒ kəˈliːfə/), known as the Burj Dubai before its inauguration, is a megatall skyscraper in Dubai, United Arab Emirates. It is the tallest structure in the 
 
     world, standing at 829.8 m (2,722 ft)</p> 
 
    </div> 
 

 
    <div id="khalifa"> 
 
     <a href="#"> 
 
     <img src="images/chrysler.jpg" alt=""> 
 
     </a> 
 
     <h1>Burj-Al-Khalifa</h1> 
 
     <p>The Burj Khalifa (Arabic: برج خليفة‎‎, Arabic for "Khalifa Tower"; pronounced English /ˈbɜːrdʒ kəˈliːfə/), known as the Burj Dubai before its inauguration, is a megatall skyscraper in Dubai, United Arab Emirates. It is the tallest structure in the 
 
     world, standing at 829.8 m (2,722 ft)</p> 
 
    </div> 
 

 
    </div> 
 
</div>

答えて

0

50%(私は、CSS IDの#empireを変え、そして#khalifa代わりにフロートを使用するインラインブロックの表示を使用すること、及びCALCに50%のそれらの幅を調整 - 2px)。

#bottom{ 
 
\t width: 100%; 
 
\t height: 100%; 
 
\t padding: 0px; 
 
\t margin: 0px; 
 
\t background-repeat: repeat; 
 
\t background-size: cover; 
 
\t background-position: fixed; 
 
\t background: linear-gradient(rgba(255, 0, 0, 0.5),rgba(0, 255, 0, 0.5),rgba(0, 0, 255, 0.5)); 
 
} 
 
#khalifa{ 
 
\t height: 100%; 
 
\t width: calc(50% - 2px); 
 
\t display: inline-block; 
 
} 
 
#bottom h1{ 
 
\t text-align: center; 
 
\t text-transform: uppercase; 
 
\t font-weight: bold; 
 
\t color: maroon; 
 
} 
 
#bottom p{ 
 
\t text-align: justify; 
 
\t padding: 20px; 
 
\t font-size: 18px; 
 
\t font-family: sans-serif; 
 
} 
 
#bottom img{ 
 
\t width: 100%; 
 
\t height: 700px; 
 
} 
 
#empire{ 
 
\t width: calc(50% - 2px); 
 
\t display: inline-block; 
 
}
<div id="bottom"> 
 
\t \t \t <div> 
 
\t \t \t \t <div id="khalifa"> 
 
\t \t \t \t \t 
 
\t \t \t \t \t <a href="#"><img src="images/khalifa.jpg" alt=""></a> 
 
\t \t \t \t \t <h1>Burj-Al-Khalifa</h1> 
 
\t \t \t \t \t <p>The Burj Khalifa (Arabic: برج خليفة‎‎, Arabic for "Khalifa Tower"; pronounced English /ˈbɜːrdʒ kəˈliːfə/), known as the Burj Dubai before its inauguration, is a megatall skyscraper in Dubai, United Arab Emirates. It is the tallest structure in the world, standing at 829.8 m (2,722 ft)</p> 
 
\t \t \t \t </div> 
 
\t \t \t \t <div id="empire"> 
 
\t \t \t \t \t 
 
\t \t \t \t \t <a href="#"><img src="images/empire.jpg" alt=""></a> 
 
\t \t \t \t \t <h1>Empire State</h1> 
 
\t \t \t \t \t <p>The Burj Khalifa (Arabic: برج خليفة‎‎, Arabic for "Khalifa Tower"; pronounced English /ˈbɜːrdʒ kəˈliːfə/), known as the Burj Dubai before its inauguration, is a megatall skyscraper in Dubai, United Arab Emirates. It is the tallest structure in the world, standing at 829.8 m (2,722 ft)</p> 
 
\t \t \t \t </div> 
 
\t \t \t \t <div id="royal"> 
 
\t \t \t \t \t 
 
\t \t \t \t \t <a href="#"><img src="images/oneworld.jpg" alt=""></a> 
 
\t \t \t \t \t <h1>Burj-Al-Khalifa</h1> 
 
\t \t \t \t \t <p>The Burj Khalifa (Arabic: برج خليفة‎‎, Arabic for "Khalifa Tower"; pronounced English /ˈbɜːrdʒ kəˈliːfə/), known as the Burj Dubai before its inauguration, is a megatall skyscraper in Dubai, United Arab Emirates. It is the tallest structure in the world, standing at 829.8 m (2,722 ft)</p> 
 
\t \t \t \t </div> 
 
\t \t \t \t <div id="empire"> 
 
\t \t \t \t \t 
 
\t \t \t \t \t <a href="#"><img src="images/kingdom.jpg" alt=""></a> 
 
\t \t \t \t \t <h1>Empire State</h1> 
 
\t \t \t \t \t <p>The Burj Khalifa (Arabic: برج خليفة‎‎, Arabic for "Khalifa Tower"; pronounced English /ˈbɜːrdʒ kəˈliːfə/), known as the Burj Dubai before its inauguration, is a megatall skyscraper in Dubai, United Arab Emirates. It is the tallest structure in the world, standing at 829.8 m (2,722 ft)</p> 
 
\t \t \t \t </div> 
 
\t \t \t \t <div id="khalifa"> 
 
\t \t \t \t \t 
 
\t \t \t \t \t <a href="#"><img src="images/chrysler.jpg" alt=""></a> 
 
\t \t \t \t \t <h1>Burj-Al-Khalifa</h1> 
 
\t \t \t \t \t <p>The Burj Khalifa (Arabic: برج خليفة‎‎, Arabic for "Khalifa Tower"; pronounced English /ˈbɜːrdʒ kəˈliːfə/), known as the Burj Dubai before its inauguration, is a megatall skyscraper in Dubai, United Arab Emirates. It is the tallest structure in the world, standing at 829.8 m (2,722 ft)</p> 
 
\t \t \t \t </div> 
 
    <script type="text/javascript"> 
 
     
 
    </script> 
 

 
</div></div>

0

ちょうどあなたがあなたのCSSにフロートを使用しているため<div style="clear:both;"></div>のようなdiv要素を追加するので、あなたはそれらのフロートをクリアする必要があります。それが正常に動作フロートをクリアした後、私はちょうどそのC

#bottom { 
 
    width: 100%; 
 
    height: 100%; 
 
    padding: 0px; 
 
    margin: 0px; 
 
    background-repeat: repeat; 
 
    background-size: cover; 
 
    background-position: fixed; 
 
    background: linear-gradient(rgba(255, 0, 0, 0.5), rgba(0, 255, 0, 0.5), rgba(0, 0, 255, 0.5)); 
 
} 
 
#khalifa { 
 
    height: 100%; 
 
    width: 50%; 
 
    float: left; 
 
} 
 
#bottom h1 { 
 
    text-align: center; 
 
    text-transform: uppercase; 
 
    font-weight: bold; 
 
    color: maroon; 
 
} 
 
#bottom p { 
 
    text-align: justify; 
 
    padding: 20px; 
 
    font-size: 18px; 
 
    font-family: sans-serif; 
 
} 
 
#bottom img { 
 
    width: 100%; 
 
    height: 700px; 
 
} 
 
#empire { 
 
    width: 50%; 
 
    float: left; 
 
}
<div id="bottom"> 
 
    <div> 
 
    <div id="khalifa"> 
 
     <a href="#"> 
 
     <img src="images/khalifa.jpg" alt=""> 
 
     </a> 
 
     <h1>Burj-Al-Khalifa</h1> 
 
     <p>The Burj Khalifa (Arabic: برج خليفة‎‎, Arabic for "Khalifa Tower"; pronounced English /ˈbɜːrdʒ kəˈliːfə/), known as the Burj Dubai before its inauguration, is a megatall skyscraper in Dubai, United Arab Emirates. It is the tallest structure in the 
 
     world, standing at 829.8 m (2,722 ft)</p> 
 
    </div> 
 

 
    <div id="empire"> 
 
     <a href="#"> 
 
     <img src="images/empire.jpg" alt=""> 
 
     </a> 
 
     <h1>Empire State</h1> 
 
     <p>The Burj Khalifa (Arabic: برج خليفة‎‎, Arabic for "Khalifa Tower"; pronounced English /ˈbɜːrdʒ kəˈliːfə/), known as the Burj Dubai before its inauguration, is a megatall skyscraper in Dubai, United Arab Emirates. It is the tallest structure in the 
 
     world, standing at 829.8 m (2,722 ft)</p> 
 
    </div> 
 

 
    <div id="royal"> 
 
     <a href="#"> 
 
     <img src="images/oneworld.jpg" alt=""> 
 
     </a> 
 
     <h1>Burj-Al-Khalifa</h1> 
 
     <p>The Burj Khalifa (Arabic: برج خليفة‎‎, Arabic for "Khalifa Tower"; pronounced English /ˈbɜːrdʒ kəˈliːfə/), known as the Burj Dubai before its inauguration, is a megatall skyscraper in Dubai, United Arab Emirates. It is the tallest structure in the 
 
     world, standing at 829.8 m (2,722 ft)</p> 
 
    </div> 
 

 
    <div id="empire"> 
 
     <a href="#"> 
 
     <img src="images/kingdom.jpg" alt=""> 
 
     </a> 
 
     <h1>Empire State</h1> 
 
     <p>The Burj Khalifa (Arabic: برج خليفة‎‎, Arabic for "Khalifa Tower"; pronounced English /ˈbɜːrdʒ kəˈliːfə/), known as the Burj Dubai before its inauguration, is a megatall skyscraper in Dubai, United Arab Emirates. It is the tallest structure in the 
 
     world, standing at 829.8 m (2,722 ft)</p> 
 
    </div> 
 

 
    <div id="khalifa"> 
 
     <a href="#"> 
 
     <img src="images/chrysler.jpg" alt=""> 
 
     </a> 
 
     <h1>Burj-Al-Khalifa</h1> 
 
     <p>The Burj Khalifa (Arabic: برج خليفة‎‎, Arabic for "Khalifa Tower"; pronounced English /ˈbɜːrdʒ kəˈliːfə/), known as the Burj Dubai before its inauguration, is a megatall skyscraper in Dubai, United Arab Emirates. It is the tallest structure in the 
 
     world, standing at 829.8 m (2,722 ft)</p> 
 
    </div> 
 
<div style="clear:both;"></div> 
 
    </div> 
 
</div>

を追加しました
関連する問題