为什么溢出:隐藏只在chrome中工作而不在firefox中

问题描述 投票:0回答:2

溢出:隐藏属性在谷歌浏览器中工作,而不是在Firefox和微软边缘,我用它来给边栏提供整页高度,以便它具有相同的身高。

样式:

.sidebar {
   position:absolute;
   width: 225px;
   background-color: #4b4b4b;
   margin-bottom: -5000px;
   padding-bottom: 5000px;
   overflow: hidden;
  }

HTML:

<div class="sidebar">
    <div class="nav-item active">
    <a class="nav-link border-bottom border-warning {{Request::path()=='home' ? 'selectioné' : ''}}" href="home"><span>Dashboard</span></a>
    </div>
    <div class="nav-item">
    <a class="nav-link border-bottom border-warning {{Request::path()=='register' ? 'selectioné' : ''}}" href="register"><span>Ajout Compte</span></a>
    </div>
    <div class="nav-item">
    <a class="nav-link border-bottom border-warning" href="*******"><span>*******</span></a>
    </div>
    <div class="nav-item">
    <a class="nav-link border-bottom border-warning" href="/telescope" target="_blank"><span>Telescope</span></a>
    </div>
    <div class="nav-item">
    <a class="nav-link border-bottom border-warning" href="tables.html"><span>Tables3</span></a>
    </div>
    <div class="nav-item">
    <a class="nav-link border-bottom border-warning" href="tables.html"><span>Tables4</span></a>
    </div>
</div>

身体 :

body {
  position: relative;
  min-height: 100vh;
  padding-bottom: 4.5rem;
 }

页脚:

footer {
   position: absolute;
   border-radius: 12px;
   right: 0;
   bottom: 0;
   width: calc(100% - 225px);
   height: 80px;
   background-color: #e2e2e2;
  text-align: center;
  padding-top: 28px;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

主要:

.main {
  width: 100%;
  padding-left: 225px;
  padding-top: 11px;
  padding-bottom: 30px;
}

我怎样才能在所有浏览器中使用它?

css firefox overflow sidebar
2个回答
0
投票

试试这个 :

.sidebar {
  width: 225px;
  background-color: #4b4b4b;
  position: absolute;
  top: 60px;
  bottom: 0;
}

0
投票

margin-bottom: -5000px; padding-bottom: 5000px; css中删除.sidebar并添加min-height: 100vh;,我希望它能解决您的问题。谢谢

.sidebar {
   position:absolute;
   width: 225px;
   min-height: 100vh;
   background-color: #4b4b4b;
   overflow: hidden;
}
© www.soinside.com 2019 - 2024. All rights reserved.