html - CSS Nav 溢出容器

标签 html css

我有一个不响应容器的 css 导航。在 JSFiddle here一切正常。当我把它放在网站上时 here移动菜单下 zipper 接转到包装器的右上角,不会留在容器中。如果缩小屏幕,您会看到。目前在网站上它位于标题部分之外,因为我认为可能存在代码冲突。谢谢

CSS

.nav-mobile {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  background: $nav-background;
  height: $nav-height;
  width: $nav-height;
}
@media only screen and (max-width: $breakpoint) {
  // Hamburger nav visible on mobile only
  .nav-mobile {
    display: block;
  }
  nav {
   width: 100%;
    padding: $nav-height 0 15px;
    ul {
      display: none;
      li {
        float: none;
        a {
          padding: 15px;
          line-height: 20px;
        }
        ul li a {
          padding-left: 30px;
        }
      }
    }
  }
  .nav-dropdown {
    position: static;
  }
}
@media screen and (min-width: $breakpoint) {
  .nav-list {
    display: block !important;
  }
}
#nav-toggle {
  position: absolute;
  left: 18px;
  top: 22px;
  cursor: pointer;
  padding: 10px 35px 16px 0px;
  span,
  span:before,
  span:after {
    cursor: pointer;
    border-radius: 1px;
    height: 5px;
    width: 35px;
    background: $nav-font-color;
    position: absolute;
    display: block;
    content: '';
    transition: all 300ms ease-in-out;
  }
  span:before {
    top: -10px;
  }
  span:after {
    bottom: -10px;
  }
  &.active span {
    background-color: transparent;
    &:before,
    &:after {
      top: 0;
    }
    &:before {
      transform: rotate(45deg);
    }
    &:after {
      transform: rotate(-45deg);
    }
  }
}

最佳答案

nav 标签中添加以下 css

// Navigation 
nav {
  position: relative;

关于html - CSS Nav 溢出容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46146431/

相关文章:

html - Bootstrap 进度条背景颜色问题

css - 我无法让它们通过 CSS 正确 float

css - 带三 Angular 形的响应式按钮

仅 CSS 选项卡需要在选项卡内标准呈现单选按钮和标签

jquery - 一个简单的CSS定位系统。试图将它们完美均匀地对齐

html - 如何增加html <audio>标签的高度

html - 显示重影值的子菜单

jquery - 使用 id 选择器的媒体查询

asp.net - 搜索引擎博客文章的特定元标记

html - Bootstrap 导航栏自定义