Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 固定宽度列表项扩展页面的整个长度_Html_Css_Fixed Width - Fatal编程技术网

Html 固定宽度列表项扩展页面的整个长度

Html 固定宽度列表项扩展页面的整个长度,html,css,fixed-width,Html,Css,Fixed Width,我有一个导航菜单,它占据了页面左侧高达250像素的宽度和100%的高度。我加了一个1。固定了导航菜单顶部的标题列表项,以及2。修复了导航菜单最底部的页脚列表项。我的想法是保持这两个项目固定不变,当浏览器宽度达到一定大小时,这两个项目也必须消失。但我有一个大问题: 问题1:当我将固定宽度添加到.topfilter和bottomfilter时,列表项现在扩展了 整个页面,而不是导航菜单 问题2:现在,当我调整浏览器的大小时,会显示固定宽度的项目 不要消失 好处:我也不知道如何在.topfilter和

我有一个导航菜单,它占据了页面左侧高达250像素的宽度和100%的高度。我加了一个1。固定了导航菜单顶部的标题列表项,以及2。修复了导航菜单最底部的页脚列表项。我的想法是保持这两个项目固定不变,当浏览器宽度达到一定大小时,这两个项目也必须消失。但我有一个大问题:

问题1:当我将固定宽度添加到.topfilterbottomfilter时,列表项现在扩展了 整个页面,而不是导航菜单

问题2:现在,当我调整浏览器的大小时,会显示固定宽度的项目 不要消失

好处:我也不知道如何在.topfilter和.bottomfilter中添加填充,这样它们就不会掩盖前面的文本。 填充顶部和填充底部不起作用

固定宽度项目:

HTML:

         <!-- Sidebar -->
  <div id="sidebar-wrapper">


    <ul class="sidebar-nav">
    <li class="topfilter">
   <a class="filtertitle">Title</a>
   </li>

      <li>
        <a href="#/content">
        Content
        </a>
      </li>
              <li>
        <a href="#/topics">
        Topics
        </a>
      </li>
              <li>
        <a href="#">
        Groups
        </a>
      </li>
              <li>
        <a href="#">
        Premium
        </a>
      </li>
      <li>
        <a href="#">Dashboard</a>
      </li>
      <li>
        <a href="#">Shortcuts</a>
      </li>
      <li>
        <a href="#">Overview</a>
      </li>
      <li>
        <a href="#">Events</a>
      </li>
      <li>
        <a href="#">About</a>
      </li>
      <li>
        <a href="#">Services</a>
      </li>
      <li>
        <a href="#">Contact</a>
      </li>

        <li class="bottomfilter">
   <a class="filtertitle">Footer</a>
   </li>

    </ul>
  </div>
  <!-- /#sidebar-wrapper -->



  <div class="content" style="min-height:90%; background:white;"  >



  </div>
  <div class="push"></div>

<footer class="footer">


        </footer>
a {outline:none !important;}

html,
body,
.wrap {
  height: 100%;
}

.wrap {
  box-sizing: border-box;
}

form {
  height: 100%
}

.wrap {
  min-height: 100%;
  height: auto !important;
  height: 100%;
  margin-bottom: -60px;
  /* for sticky footer to not go below page */
  /* for sticky header to not overlap content */
}

.push,
.footer {
  height: 60px;
}



.footer {
  background-color: #ebebeb;
  height: 60px;
  width: 100%;
  position: fixed;
  bottom: 0;   
}

.content {
  position: absolute;
  width: 100%;
  top: 120px;
  background-color: yellow;
  z-index: 0;
}


#sidebar-wrapper {
  z-index: 1000;
  position: fixed;
  left: 142px;
  top: 0px;
  margin-bottom: 60px;
  width: 0;
  height: 100%;
  margin-left: -142px;
  overflow-y: auto; overflow-x: hidden;
  background: #eee;
  -webkit-transition: all 0.5s ease;
  -moz-transition: all 0.5s ease;
  -o-transition: all 0.5s ease;
  transition: all 0.5s ease;
}


.topfilter {border-bottom:solid #333 2px; width:100%; height:40px; position:fixed; display:block; text-align:left; background-color:blue; -moz-box-sizing: border-box:
    box-sizing: border-box:}

.filtertitle { position:relative; display:inline-block; color:#000; width:100%; }

.topfilter {border-bottom:solid #333 2px; width:100%; height:40px; position:fixed; display:block; text-align:left; background-color:blue; -moz-box-sizing: border-box:
    box-sizing: border-box:}

.filtertitle { position:relative; display:inline-block; color:#000; width:100%; }

.topfilter {border-bottom:solid #333 2px; width:100%; height:40px; position:fixed; display:block; text-align:left; background-color:blue; -moz-box-sizing: border-box;
    box-sizing: border-box;}


.bottomfilter {border-top: solid #333 2px; width:100%; height:50px; position:fixed; display:block; text-align:left; background-color:red; -moz-box-sizing: border-box; box-sizing: border-box; bottom:0;}


#wrapper.toggled #sidebar-wrapper {
  width: 200px;
}

#page-content-wrapper {
  width: 100%;
  position: absolute;
  padding: 15px;
}

   #wrapper.toggled #page-content-wrapper {
  position: absolute;
  margin-right: -200px;
}


/* Sidebar Styles */

.sidebar-nav {
  position: absolute;
  top: 0px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-nav li {
  text-indent: 20px;
  line-height: 40px;
}

.sidebar-nav li a {
  display: block;
  text-decoration: none;
  color: #999999;
}

.sidebar-nav li a:hover {
  text-decoration: none;
  color: #333;
  background: rgba(255, 255, 255, 0.6);
}

.sidebar-nav li a:active,
.sidebar-nav li a:focus {
  text-decoration: none;
}

.sidebar-nav > .sidebar-brand {
  height: 65px;
  font-size: 18px;
  line-height: 60px;
}

.sidebar-nav > .sidebar-brand a {
  color: #999999;
}

.sidebar-nav > .sidebar-brand a:hover {
  color: #fff;
  background: none;
}

@media screen and (min-width:768px) {
  #wrapper {
    padding-left: 300px;
  }
  #wrapper.toggled {
    padding-left: 0;
  }


  #wrapper.toggled #sidebar-wrapper {
    width: 0;
  }
  #page-content-wrapper {
    padding: 20px;
    position: relative;
  }
  #wrapper.toggled #page-content-wrapper {
    position: relative;
    margin-right: 0;
  }
}


@media screen and (max-width:1526px) {

  .content,
  .footer {
    width: 82%;
    right: 0; 
  }
  .header {width:82%;}

    #sidebar-wrapper {
    width: 18%; 
  }

}


@media screen and (max-width:1059px) {

  .content,
  .footer {
    width: 80%;
    right: 0; 
  }

  .header {width:80%;}

    #sidebar-wrapper {
    width: 20%; 
  }
}   

     @media screen and (min-width:1527px) {

  .content,
  .footer {
    width: 85%;
    right: 0; 
  }
  .header {width:85%;}
    #sidebar-wrapper {
    width: 15%; 
  }


}

        @media screen and (max-width:991px) {
          .content,
  .footer {
    width: 100%;
    right: 0; 
  }

    #sidebar-wrapper {
    width:0; 
  }

答案很简单:

我所要做的就是:

  • 在父容器上添加最小宽度:100%,并将宽度:100%替换为宽度:继承。侧栏导航

  • 然后在位置固定的两个子项上添加width:inherit.topfilter.bottomfilter

  • 下面是为我修复它的代码:

    .sidebar-nav {
    
      width:inherit; min-width:100%;
    
    }
    
    
    .topfilter {width:inherit; position:fixed;}
    
    
    .bottomfilter { width:inherit; position:fixed; 
    

    注意:现在我有另一个问题,固定项目重叠在滚动条上,但我会在另一个线程上问这个问题,除非有人能快速回答如何修复它

    答案很简单:

    我所要做的就是:

  • 在父容器上添加最小宽度:100%,并将宽度:100%替换为宽度:继承。侧栏导航

  • 然后在位置固定的两个子项上添加width:inherit.topfilter.bottomfilter

  • 下面是为我修复它的代码:

    .sidebar-nav {
    
      width:inherit; min-width:100%;
    
    }
    
    
    .topfilter {width:inherit; position:fixed;}
    
    
    .bottomfilter { width:inherit; position:fixed; 
    
    注意:现在我有另一个问题,固定项目重叠在滚动条上,但我会在另一个线程上问这个问题,除非有人能快速回答如何修复它