2016-11-30 21 views
0

我創建了一個只使用html,css和jquery的小型網站。沒有自舉...如何讓部分成爲100%瀏覽器長度

問題: 我的圖像和div沒有顯示100%的瀏覽器寬度。我有一個白色的邊框,一直圍繞我的網站。每個div都有一個圖像作爲背景。我試圖告訴它在CSS中100%,但我只是拿到手指。

臭氧DIV:

<!-- OZONE SECTION 
    =============================================== --> 
    <section id="ozone"> 
     <div class="ozone_module"> 
      <h2>The link between Ozone depletion and Climate Change</h2> 
      <p>Atmospheric ozone has two effects on the temperature balance of the Earth. It absorbs solar ultraviolet radiation, which heats the stratosphere. It also absorbs infrared radiation emitted by the Earth's surface, effectively trapping heat in the troposphere. Therefore, the climate impact of changes in ozone concentrations varies with the altitude at which these ozone changes occur. The major ozone losses that have been observed in the lower stratosphere due to the human-produced chlorine- and bromine-containing gases have a cooling effect on the Earth's surface. On the other hand, the ozone increases that are estimated to have occurred in the troposphere because of surface-pollution gases have a warming effect on the Earth's surface, thereby contributing to the "greenhouse" effect.</p> 

      <p> the increase in carbon dioxide is the major contributor to climate change. Carbon dioxide concentrations are increasing in the atmosphere primarily as the result of the burning of coal, oil, and natural gas for energy and transportation. The atmospheric abundance of carbon dioxide is currently about 30% above what it was 150 years ago.</p> 

      <p>There is an additional factor that indirectly links ozone depletion to climate change; namely, many of the same gases that are causing ozone depletion are also contributing to climate change. These gases, such as the chlorofluorocarbons (CFCs), are greenhouse gases, absorbing some of the infrared radiation emitted by the Earth's surface, thereby effectively heating the Earth's surface.</p> 

      <p>Conversely, changes in the climate of the Earth could affect the behavior of the ozone layer, because ozone is influenced by changes in the meteorological conditions and by changes in the atmospheric composition that could result from climate change. The major issue is that the stratosphere will most probably cool in response to climate change, therefore preserving over a longer time period the conditions that promote chlorine-caused ozone depletion in the lower stratosphere, particularly in polar regions.</p> 

      <a class="source" href="http://www.esrl.noaa.gov/csd/assessments/ozone/1998/faq9.html" target="_blank"><h4>National Oceanic and Atmospheric Administration </h4></a> 

     </div> 
    </section><!-- ozone --> 

臭氧CSS:

/* OZONE */ 
#ozone { 
    background: url('../img/NASA_ozone.jpg') 50% 0 no-repeat fixed; 
    min-height: 800px; 
    padding: 40px 0px; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 
} 

.ozone_module { 
    border-radius: 15px; 
    background: rgba(255, 255, 255, 0.75); 
    opacity: .9;  
    padding: 2px 8px; 
    color: black; 
    margin-left: 60%; 
    margin-top: 50px; 
    margin-right: 15px; 
    font: 14px Sans-Serif; 
} 
+0

請仔細閱讀[問],特別是關於製作一個有用的標題的一點:*寫一個總結sp的標題ecific問題* –

+0

你在哪裏得到這些邊界? –

+0

檢查'body'的邊距。你可能會有一些'保證金'或'填充' –

回答

1

在大多數主流瀏覽器,默認餘量爲8像素四面八方。它由您的瀏覽器提供的用戶代理樣式表以像素爲單位定義。

使用try,

body 
{ 
    margin:0; 
} 
+0

我認爲這是一個大聲笑。 – F0xcr4f7

+0

發生了什麼?它不工作? –

+0

它工作。我只是錯過了那些容易的事情。感謝您的協助! – F0xcr4f7

0

你可能需要從身體中刪除任何默認空白和邊距:

body { 
    padding: 0; 
    margin: 0; 
} 

/* OZONE */ 
 

 
body { 
 
    padding: 0; 
 
    margin: 0; 
 
} 
 
#ozone { 
 
    background: url('http://placekitten.com/g/800/600 ') 50% 0 no-repeat fixed; 
 
    min-height: 800px; 
 
    padding: 40px 0px; 
 
    -webkit-background-size: cover; 
 
    -moz-background-size: cover; 
 
    -o-background-size: cover; 
 
    background-size: cover; 
 
} 
 
.ozone_module { 
 
    border-radius: 15px; 
 
    background: rgba(255, 255, 255, 0.75); 
 
    opacity: .9; 
 
    padding: 2px 8px; 
 
    color: black; 
 
    margin-left: 60%; 
 
    margin-top: 50px; 
 
    margin-right: 15px; 
 
    font: 14px Sans-Serif; 
 
}
<section id="ozone"> 
 
    <div class="ozone_module"> 
 
    <h2>The link between Ozone depletion and Climate Change</h2> 
 
    <p>Atmospheric ozone has two effects on the temperature balance of the Earth. It absorbs solar ultraviolet radiation, which heats the stratosphere. It also absorbs infrared radiation emitted by the Earth's surface, effectively trapping heat in the troposphere. 
 
     Therefore, the climate impact of changes in ozone concentrations varies with the altitude at which these ozone changes occur. The major ozone losses that have been observed in the lower stratosphere due to the human-produced chlorine- and bromine-containing 
 
     gases have a cooling effect on the Earth's surface. On the other hand, the ozone increases that are estimated to have occurred in the troposphere because of surface-pollution gases have a warming effect on the Earth's surface, thereby contributing 
 
     to the "greenhouse" effect.</p> 
 

 
    <p>the increase in carbon dioxide is the major contributor to climate change. Carbon dioxide concentrations are increasing in the atmosphere primarily as the result of the burning of coal, oil, and natural gas for energy and transportation. The atmospheric 
 
     abundance of carbon dioxide is currently about 30% above what it was 150 years ago.</p> 
 

 
    <p>There is an additional factor that indirectly links ozone depletion to climate change; namely, many of the same gases that are causing ozone depletion are also contributing to climate change. These gases, such as the chlorofluorocarbons (CFCs), are 
 
     greenhouse gases, absorbing some of the infrared radiation emitted by the Earth's surface, thereby effectively heating the Earth's surface.</p> 
 

 
    <p>Conversely, changes in the climate of the Earth could affect the behavior of the ozone layer, because ozone is influenced by changes in the meteorological conditions and by changes in the atmospheric composition that could result from climate change. 
 
     The major issue is that the stratosphere will most probably cool in response to climate change, therefore preserving over a longer time period the conditions that promote chlorine-caused ozone depletion in the lower stratosphere, particularly in 
 
     polar regions.</p> 
 

 
    <a class="source" href="http://www.esrl.noaa.gov/csd/assessments/ozone/1998/faq9.html" target="_blank"><h4>National Oceanic and Atmospheric Administration </h4></a> 
 

 
    </div> 
 
</section> 
 
<!-- ozone -->

+0

''沒有默認填充,只有餘量。 – Aaron

相關問題