html
  • css
  • 2016-01-08 21 views 0 likes 
    0

    我想垂直對齊2個div - 頁面底部的頁腳div(距離底部大約15px頁邊距),以及內容div頁面中心)。該網頁將作出迴應。她是在頁面的jsfiddle: https://jsfiddle.net/tyvodoh0/1/在頁面底部設置div而不與另一個div在較小的屏幕尺寸上重疊

    <div class="wrapper"> 
        <div class='center'> 
         <div id='content'> 
          <div id='profile_pic'> 
           <img src='http://www.keenthemes.com/preview/metronic/theme/assets/global/plugins/jcrop/demos/demo_files/image1.jpg'/> 
          </div> 
          <div id='information'> 
           <h1>Title</h1> 
           <h2>Subtitle</h2> 
             <p> 4 
    down vote 
    favorite 
    
    
    Does the position of the sun in a hollow earth scenario affect the way light scattering would "color" the sky? 
    
    My understanding is the reddish-orange color during sunrise/sunset is caused by the sun being at a more oblique angle in contrast to the standard blue when the sun is fully up. 
    
    My intuition states that the sky's color wouldn't change much, or if it did would become a washed out version of whatever it normally would be, ie blue on Earth. The most dramatic coloring that I could imagine would be a gradient from say blue to red as you look from the center of the sky to the horizon, given an Earth colored sun and atmosphere. I doubt the gradient scenario is possible, but it would be neat if it was. 
    </p> 
    
          </div> 
         </div> 
         <div class='footer'> 
         <p> 
         Div to be set at bottom 
         </p> 
         </div> 
        </div> 
    </div> 
    
    /* css */ 
    
        h1 { 
        color: #3a2a0c; 
        font-size: 47px; 
        text-transform: uppercase; 
        margin-bottom: 14px; 
    } 
    
    h2 { 
        color: #3a2a0c; 
        font-size: 28px; 
        text-transform: capitalize; 
        margin-bottom: 14px; 
    } 
    
    h3 { 
        color: #926d55; 
        font-size: 15px; 
        margin-bottom: 40px; 
    } 
    
    p { 
        color: #3a2a0c; 
        font-size: 15px; 
        text-align: justify; 
        line-height: 110%; 
        border-bottom: 1px solid #caccc6; 
    } 
    
    hr { 
        border-color: #3edf4f6; 
        margin-top: 50px; 
    } 
    
    .wrapper { 
        background-color: rgba(255,255,255,0.9); 
        padding: 0; 
        margin: 0; 
        top: 0; 
        left: 0; 
        display: table; 
        position: absolute; 
        height: 100%; 
        width: 100%; 
    } 
    
    .center { 
        display: table-cell; 
        vertical-align: middle; 
        background: pink; 
        float: none; 
    } 
    
    #content { 
        margin-left: auto; 
        margin-right: auto; 
        width: 1235px; 
        background: red; 
    } 
    
    #profile_pic { 
        width: 396px; 
        padding-right: 33px; 
        float: left; 
        background: blue; 
    } 
    
    #profile_pic img { 
        width: 396px; 
        height: auto; 
        } 
    } 
    
    #information { 
        width: 806px; 
        background: yellow; 
        float: left; 
    } 
    
    #contact { 
        font-size: 15px; 
        color: #926d55; 
    } 
    
    .hide { 
        display: none; 
    } 
    
    #contact span { 
        margin-right:22px; 
    } 
    
    #information p { 
        padding: 40px 0; 
    } 
    
    #left { 
        float: left; 
    } 
    
    #right { 
        float: right; 
    } 
    
    .links { 
        padding-top: 15px; 
        font-size: 15px; 
    } 
    
    .links img { 
        margin-right: 6px; 
    } 
    
    .links a { 
        margin-left: 6px; 
        margin-right: 6px; 
        color: #3a2a0c; 
    } 
    
    .links a:last-child { 
        margin-right: 0px; 
    } 
    
    .links a:hover { 
        color: #926d55; 
    } 
    
    .footer { 
        float: none; 
        position: absolute; 
        top: 90%; 
    } 
    

    回答

    0

    我編輯了您的代碼以使其響應。調整窗口大小時,您可以進一步修復圖像的位置。

    h1 { 
     
    \t color: #3a2a0c; 
     
    \t font-size: 47px; 
     
    \t text-transform: uppercase; 
     
    \t margin-bottom: 14px; 
     
    } 
     
    
     
    h2 { 
     
    \t color: #3a2a0c; 
     
    \t font-size: 28px; 
     
    \t text-transform: capitalize; 
     
    \t margin-bottom: 14px; 
     
    } 
     
    
     
    h3 { 
     
    \t color: #926d55; 
     
    \t font-size: 15px; 
     
    \t margin-bottom: 40px; 
     
    } 
     
    
     
    p { 
     
    \t color: #3a2a0c; 
     
    \t font-size: 15px; 
     
    \t text-align: justify; 
     
    \t line-height: 110%; 
     
    \t border-bottom: 1px solid #caccc6; 
     
    } 
     
    
     
    hr { 
     
    \t border-color: #3edf4f6; 
     
    \t margin-top: 50px; 
     
    } 
     
    
     
    .wrapper { 
     
    \t background-color: rgba(255,255,255,0.9); 
     
    \t padding: 0; 
     
    \t margin: 0; 
     
    \t top: 0; 
     
    \t left: 0; 
     
    \t display: table; 
     
        position: absolute; 
     
        height: 100%; 
     
        width: 100%; 
     
    } 
     
    
     
    .center { 
     
        display: table-cell; 
     
        vertical-align: middle; 
     
    \t background: pink; 
     
    \t float: none; 
     
    } 
     
    
     
    #content { 
     
        margin: auto; 
     
        width: 100%; \t 
     
        background: red; 
     
        padding: 10px; 
     
    } 
     
    
     
    #profile_pic { 
     
    \t width: 396px; 
     
    \t padding-right: 33px; 
     
    \t float: left; 
     
    \t background: blue; 
     
    } 
     
    
     
    #profile_pic img { 
     
        width: 396px; 
     
        height: auto; 
     
    } 
     
    
     
    /*    
     
    #information { 
     
    width: 806px; 
     
    \t background: yellow; 
     
    \t float: left; 
     
    } 
     
    */    
     
    
     
    #contact { 
     
    \t font-size: 15px; 
     
    \t color: #926d55; 
     
    } 
     
    
     
    .hide { 
     
    \t display: none; 
     
    } 
     
    
     
    #contact span { 
     
    \t margin-right:22px; 
     
    } 
     
    
     
    #information p { 
     
    \t padding: 40px 0; 
     
    } 
     
    
     
    #left { 
     
    \t float: left; 
     
    } 
     
    
     
    #right { 
     
    \t float: right; 
     
    } 
     
    
     
    .links { 
     
    \t padding-top: 15px; 
     
    \t font-size: 15px; 
     
    } 
     
    
     
    .links img { 
     
    \t margin-right: 6px; 
     
    } 
     
    
     
    .links a { 
     
    \t margin-left: 6px; 
     
    \t margin-right: 6px; 
     
    \t color: #3a2a0c; 
     
    } 
     
    
     
    .links a:last-child { 
     
    \t margin-right: 0px; 
     
    } 
     
    
     
    .links a:hover { 
     
    \t color: #926d55; 
     
    } 
     
    
     
    .footer { 
     
    \t float: none; 
     
    \t top: 90%; 
     
        width: 100%; 
     
        padding: 10px; 
     
    }
    <div class="wrapper"> 
     
        <div class='center'> 
     
         <div id='content'> 
     
          <div id='profile_pic'> 
     
           <img src='http://www.keenthemes.com/preview/metronic/theme/assets/global/plugins/jcrop/demos/demo_files/image1.jpg'/> 
     
          </div> 
     
          <div id='information'> 
     
           <h1>Title</h1> 
     
           <h2>Subtitle</h2> 
     
           <p> 4 
     
    down vote 
     
    favorite 
     
    
     
    Does the position of the sun in a hollow earth scenario affect the way light scattering would "color" the sky? 
     
    
     
    My understanding is the reddish-orange color during sunrise/sunset is caused by the sun being at a more oblique angle in contrast to the standard blue when the sun is fully up. 
     
    
     
    My intuition states that the sky's color wouldn't change much, or if it did would become a washed out version of whatever it normally would be, ie blue on Earth. The most dramatic coloring that I could imagine would be a gradient from say blue to red as you look from the center of the sky to the horizon, given an Earth colored sun and atmosphere. I doubt the gradient scenario is possible, but it would be neat if it was. 
     
           </p> 
     
    
     
          </div> 
     
         </div> 
     
         <div class='footer'> 
     
          <p>Div to be set at bottom</p> 
     
         </div> 
     
        </div> 
     
    </div>

    .wrapper的高度設置爲:height:100%,你可以,如果你不需要它刪除。

    0

    從我可以看到你想要的包裝股利支付高度和頁面寬度的100%,並以設置頁腳爲在頁面的底部,你需要頁腳類更改爲

    .footer { 
        margin-bottom: 15px; 
        position: absolute; 
        bottom: 0; 
    } 
    

    這將使格留在底部15像素的保證金。

    相關問題