2016-12-20 16 views
7

के साथ सही ढंग से काम नहीं कर रहा है, मैं एक सीएसएस साइडबार और एक चिपचिपा पाद लेख चाहता था। जब साइडबार स्लाइड हो जाता है, तो शेष पृष्ठ को छोटी जगह फिट करने के लिए छोटा होना चाहिए।चिपचिपा पाद लेख साइडबार

मेरी समस्या यह है कि जब मैं मेनू खोलता हूं, चिपचिपा पाद लेख साइड वार्ड स्लाइड करेगा। लेकिन इसे भी कम करने की जरूरत है, जो यह नहीं करता है। यह पृष्ठ पर क्षैतिज रूप से शेष सामग्री की तरह फिट होना चाहिए लेकिन यह नहीं है। इसका परिणाम क्षैतिज स्क्रॉलबार में होता है जिसे मैं नहीं चाहता हूं।

मुझे फ़ूटर को कैसे कम करना चाहिए?

html, 
 
body { 
 
    height: 100%; 
 
    margin: 0; 
 
    padding: 0; 
 
} 
 
footer { 
 
    bottom: 0; 
 
    margin-left: inherit; 
 
    height: 100px; 
 
    left: 0; 
 
    width: 100%; 
 
    position: absolute; 
 
    background-color: lightgrey; 
 
} 
 
ul { 
 
    margin-left: 0; 
 
    padding-left: 0; 
 
} 
 
.footer-img { 
 
    margin-top: 15px; 
 
    margin-bottom: 15px; 
 
    display: inline-block; 
 
} 
 
.page-wrap { 
 
    box-sizing: border-box; 
 
    min-height: 100%; 
 
    position: relative; 
 
    transition-duration: 0.4s; 
 
} 
 
.page-content { 
 
    box-sizing: border-box; 
 
    min-height: 100%; 
 
    padding: 0 0 100px 0; 
 
    transition-duration: 0.4s; 
 
} 
 
.sidebar { 
 
    position: fixed; 
 
    top: 0; 
 
    left: -180px; 
 
    right: 0; 
 
    bottom: 0; 
 
    width: 120px; 
 
    padding: 30px; 
 
    background-color: black; 
 
    z-index: 0; 
 
    transition-duration: 0.4s; 
 
} 
 
.sidebar li { 
 
    color: white; 
 
    font-size: 18px; 
 
    margin-bottom: 15px; 
 
} 
 
.toggle { 
 
    position: fixed; 
 
    top: 20px; 
 
    left: 20px; 
 
    z-index: 1; 
 
    color: white; 
 
    transition-duration: 0.4s; 
 
} 
 
#sidebartoggler { 
 
    display: none; 
 
} 
 
#sidebartoggler:checked + .page-wrap .sidebar { 
 
    left: 0; 
 
} 
 
#sidebartoggler:checked + .page-wrap .toggle { 
 
    left: 200px; 
 
} 
 
#sidebartoggler:checked + .page-wrap .page-content { 
 
    margin-left: 180px; 
 
}
<!doctype html> 
 
<html lang="en"> 
 

 
<body> 
 

 
    <input type="checkbox" id="sidebartoggler" name="" value=""> 
 
    <div class="page-wrap"> 
 

 
    <div class="page-content"> 
 
     <label for="sidebartoggler">MENU</label> 
 
     <p>Lorizzle ipsizzle dolor i'm in the shizzle amizzle, away adipiscing elit. Owned sapizzle velizzle, hizzle volutpat, suscipit quizzle, gravida vel, go to hizzle. We gonna chung check it out tortor. Sed bow wow wow. Dang sure dolizzle dapibizzle turpizzle 
 
     tempizzle fo shizzle. pellentesque break yo neck, yall et turpizzle. Fizzle izzle tortor. Pellentesque nizzle rhoncizzle crazy. In yippiyo crackalackin bling bling dictumst. Bizzle dapibizzle. Curabitur da bomb urna, pretizzle shizzlin dizzle, 
 
     gangsta ac, eleifend vitae, nunc. Funky fresh suscipizzle. Integer semper fo shizzle uhuh ... yih! get down get down. Etizzle get down get down get down get down fo shizzle nisl. Own yo' quizzle dope. Shiz check out this, ipsizzle i'm in the shizzle 
 
     malesuada scelerisque, nulla shiznit euismod felis, izzle break yo neck, yall metizzle nulla izzle mah nizzle. Vivamus ullamcorper, tortor et rizzle tellivizzle, nibh ass ultricizzle dawg, izzle luctus check it out elit izzle pimpin'. Maurizzle 
 
     bow wow wow, orci mammasay mammasa mamma oo sa volutpizzle ass, gizzle shit we gonna chung fizzle, at bibendizzle enizzle that's the shizzle funky fresh nisl. Nullizzle fizzle velizzle pizzle orci uhuh ... yih!</p> 
 
     <footer>Yeah, footer!</footer> 
 
    </div> 
 
    <div class="sidebar"> 
 
     <ul> 
 
     <li>home</li> 
 
     <li>projects</li> 
 
     <li>cool</li> 
 
     </ul> 
 
    </div> 
 
    </div> 
 

 
</body> 
 

 
</html>

उत्तर

5

आप footer से width हटाने और right: 0 जोड़ सकते हैं।

footer { 
    bottom: 0; 
    margin-left: inherit; 
    height: 100px; 
    left: 0; 
    position: absolute; 
    background-color: lightgrey; 
    right: 0; 
} 
+1

धन्यवाद, काम किया। मैं इसे कुछ मिनटों में स्वीकार करूंगा। –

+0

मुझे खुशी है कि यह काम किया। धन्यवाद सौरव रास्तोगी, मैं ब्रेक पर था इसलिए मेरे पास सही तरीके से अपडेट करने का समय नहीं था। – Armin

0

आप पाद लेख के width संपत्ति हटाने, और right: 0 जोड़ना चाहिए। चिपचिपा पाद लेख रखने के लिए, आपको absolute के बजाय position: fixed की आवश्यकता है।

html, 
 
    body { 
 
     height: 100%; 
 
     margin: 0; 
 
     padding: 0; 
 
    } 
 
    footer { 
 
     bottom: 0; 
 
     margin-left: inherit; 
 
     height: 100px; 
 
     left: 0; 
 
     right: 0; 
 
     position: fixed; 
 
     background-color: lightgrey; 
 
    } 
 
    ul { 
 
     margin-left: 0; 
 
     padding-left: 0; 
 
    } 
 
    .footer-img { 
 
     margin-top: 15px; 
 
     margin-bottom: 15px; 
 
     display: inline-block; 
 
    } 
 
    .page-wrap { 
 
     box-sizing: border-box; 
 
     min-height: 100%; 
 
     position: relative; 
 
     transition-duration: 0.4s; 
 
    } 
 
    .page-content { 
 
     box-sizing: border-box; 
 
     min-height: 100%; 
 
     padding: 0 0 100px 0; 
 
     transition-duration: 0.4s; 
 
    } 
 
    .sidebar { 
 
     position: fixed; 
 
     top: 0; 
 
     left: -180px; 
 
     right: 0; 
 
     bottom: 0; 
 
     width: 120px; 
 
     padding: 30px; 
 
     background-color: black; 
 
     z-index: 0; 
 
     transition-duration: 0.4s; 
 
    } 
 
    .sidebar li { 
 
     color: white; 
 
     font-size: 18px; 
 
     margin-bottom: 15px; 
 
    } 
 
    .toggle { 
 
     position: fixed; 
 
     top: 20px; 
 
     left: 20px; 
 
     z-index: 1; 
 
     color: white; 
 
     transition-duration: 0.4s; 
 
    } 
 
    #sidebartoggler { 
 
     display: none; 
 
    } 
 
    #sidebartoggler:checked + .page-wrap .sidebar { 
 
     left: 0; 
 
    } 
 
    #sidebartoggler:checked + .page-wrap .toggle { 
 
     left: 200px; 
 
    } 
 
    #sidebartoggler:checked + .page-wrap .page-content { 
 
     margin-left: 180px; 
 
    }
<!doctype html> 
 
    <html lang="en"> 
 

 
    <body> 
 

 
     <input type="checkbox" id="sidebartoggler" name="" value=""> 
 
     <div class="page-wrap"> 
 

 
     <div class="page-content"> 
 
      <label for="sidebartoggler">MENU</label> 
 
      <p>Lorizzle ipsizzle dolor i'm in the shizzle amizzle, away adipiscing elit. Owned sapizzle velizzle, hizzle volutpat, suscipit quizzle, gravida vel, go to hizzle. We gonna chung check it out tortor. Sed bow wow wow. Dang sure dolizzle dapibizzle turpizzle 
 
      tempizzle fo shizzle. pellentesque break yo neck, yall et turpizzle. Fizzle izzle tortor. Pellentesque nizzle rhoncizzle crazy. In yippiyo crackalackin bling bling dictumst. Bizzle dapibizzle. Curabitur da bomb urna, pretizzle shizzlin dizzle, 
 
      gangsta ac, eleifend vitae, nunc. Funky fresh suscipizzle. Integer semper fo shizzle uhuh ... yih! get down get down. Etizzle get down get down get down get down fo shizzle nisl. Own yo' quizzle dope. Shiz check out this, ipsizzle i'm in the shizzle 
 
      malesuada scelerisque, nulla shiznit euismod felis, izzle break yo neck, yall metizzle nulla izzle mah nizzle. Vivamus ullamcorper, tortor et rizzle tellivizzle, nibh ass ultricizzle dawg, izzle luctus check it out elit izzle pimpin'. Maurizzle 
 
      bow wow wow, orci mammasay mammasa mamma oo sa volutpizzle ass, gizzle shit we gonna chung fizzle, at bibendizzle enizzle that's the shizzle funky fresh nisl. Nullizzle fizzle velizzle pizzle orci uhuh ... yih!</p> 
 
      <footer>Lorizzle ipsizzle dolor i'm in the shizzle amizzle, away adipiscing elit. Owned sapizzle velizzle, hizzle volutpat, suscipit quizzle, gravida vel, go to hizzle. We gonna chung check it out tortor. Sed bow wow wow. Dang sure dolizzle dapibizzle turpizzle tempizzle fo shizzle. pellentesque break yo neck, yall et turpizzle. Fizzle izzle tortor. Pellentesque nizzle rhoncizzle crazy. In yippiyo crackalackin bling bling dictumst. Bizzle dapibizzle. Curabitur da bomb urna, pretizzle shizzlin dizzle, gangsta ac, eleifend vitae, nunc. Funky fresh suscipizzle. Integer semper fo shizzle uhuh ... yih! get 
 

 
</footer> 
 
     </div> 
 
     <div class="sidebar"> 
 
      <ul> 
 
      <li>home</li> 
 
      <li>projects</li> 
 
      <li>cool</li> 
 
      </ul> 
 
     </div> 
 
     </div> 
 

 
    </body> 
 

 
    </html>

संबंधित मुद्दे