溢出:隐藏属性在谷歌浏览器而不是在Firefox和Microsoft Edge中工作,我正在使用它为边栏提供完整的页面高度,以便它具有相同的正文高度。

样式:

.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;
}


我如何才能在所有浏览器中使用此功能?

最佳答案

尝试这个 :

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

关于css - 为什么溢出:隐藏仅在Chrome中工作,而不在Firefox中工作,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55329404/

10-11 12:10