HTML – 粘滞页脚与侧边栏无法正常工作

HTML – 粘滞页脚与侧边栏无法正常工作,第1张

概述我想要一个CSS侧边栏和一个粘性页脚.当侧边栏滑出时,页面的其余部分应缩小以适应较小的空间. 我的问题是,当我打开菜单时,粘性页脚会滑动侧边病房.但它也需要缩小,但事实并非如此.它应该像其他内容一样水平放在页面上,但事实并非如此.这导致了我不想要的水平滚动条. 我该如何缩小页脚? html,body { height: 100%; margin: 0; padding: 0;}f 我想要一个CSS侧边栏和一个粘性页脚.当侧边栏滑出时,页面的其余部分应缩小以适应较小的空间.

我的问题是,当我打开菜单时,粘性页脚会滑动侧边病房.但它也需要缩小,但事实并非如此.它应该像其他内容一样水平放在页面上,但事实并非如此.这导致了我不想要的水平滚动条.

我该如何缩小页脚?

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 >    <div >      <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 >      <ul>        <li>home</li>        <li>projects</li>        <li>cool</li>      </ul>    </div>  </div></body></HTML>
解决方法 您可以从页脚中删除宽度并向右添加:0.
footer {    bottom: 0;    margin-left: inherit;    height: 100px;    left: 0;    position: absolute;    background-color: lightgrey;    right: 0;}
总结

以上是内存溢出为你收集整理的HTML – 粘滞页脚与侧边栏无法正常工作全部内容,希望文章能够帮你解决HTML – 粘滞页脚与侧边栏无法正常工作所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1139558.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存