首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >顶栏断点-基础5

顶栏断点-基础5
EN

Stack Overflow用户
提问于 2013-11-26 13:11:20
回答 3查看 8K关注 0票数 3

我已经从Foundation4升级到了Foundation5,并且我正在尝试在顶部的中设置一个自定义断点,而不使用Sass来设置

在第4基础中,您能够更改foundation.css文件中的以下css代码:

代码语言:javascript
复制
.top-bar-js-breakpoint {
  width: 48em !important;
  ...
}

@media only screen and (min-width: 48em) {
   ...
}

但是这在Foundation 5中是不可能的,至少我无法找到CSS或JS代码来更改它。

我还尝试重新下载一个新的自定义基础安装,将TOP BAR BREAKPOINT设置为9999 to,这是不起作用的。即使在删除了所有以前的文件和代码之后。

这个简单的问题是把我逼疯了,所以如果有人用简单的解决办法把我的痛苦发泄出来,那就太好了!

提前谢谢。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2013-11-30 08:01:21

在代码中找到meta.foundation-mq-topbar css选择器,并将width属性值更改为48 to或任何您想要的大小。

另一种解决方案:建立独立的组件媒体查询,以便为每个组件更改断点。看看这段代码:

代码语言:javascript
复制
@media only screen and (min-width: 40.063em) {
  .top-bar {
    background: #333333;
    *zoom: 1;
    overflow: visible; }
    .top-bar:before, .top-bar:after {
      content: " ";
      display: table; }
    .top-bar:after {
      clear: both; }
    .top-bar .toggle-topbar {
      display: none; }
    .top-bar .title-area {
      float: left; }
    .top-bar .name h1 a {
      width: auto; }
    .top-bar input,
    .top-bar .button {
      font-size: 0.875rem;
      position: relative;
      top: 7px; }
    .top-bar.expanded {
      background: #333333; }

  .contain-to-grid .top-bar {
    max-width: 62.5em;
    margin: 0 auto;
    margin-bottom: 0; }

  .top-bar-section {
    -webkit-transition: none 0 0;
    -moz-transition: none 0 0;
    transition: none 0 0;
    left: 0 !important; }
    .top-bar-section ul {
      width: auto;
      height: auto !important;
      display: inline; }
      .top-bar-section ul li {
        float: left; }
        .top-bar-section ul li .js-generated {
          display: none; }
    .top-bar-section li.hover > a:not(.button) {
      background: #272727;
      color: white; }
    .top-bar-section li a:not(.button) {
      padding: 0 15px;
      line-height: 45px;
      background: #333333; }
      .top-bar-section li a:not(.button):hover {
        background: #272727; }
    .top-bar-section .has-dropdown > a {
      padding-right: 35px !important; }
      .top-bar-section .has-dropdown > a:after {
        content: "";
        display: block;
        width: 0;
        height: 0;
        border: inset 5px;
        border-color: rgba(255, 255, 255, 0.4) transparent transparent transparent;
        border-top-style: solid;
        margin-top: -2.5px;
        top: 22.5px; }
    .top-bar-section .has-dropdown.moved {
      position: relative; }
      .top-bar-section .has-dropdown.moved > .dropdown {
        display: none; }
    .top-bar-section .has-dropdown.hover > .dropdown, .top-bar-section .has-dropdown.not-click:hover > .dropdown {
      display: block; }
    .top-bar-section .has-dropdown .dropdown li.has-dropdown > a:after {
      border: none;
      content: "\00bb";
      top: 1rem;
      margin-top: -2px;
      right: 5px; }
    .top-bar-section .dropdown {
      left: 0;
      top: auto;
      background: transparent;
      min-width: 100%; }
      .top-bar-section .dropdown li a {
        color: white;
        line-height: 1;
        white-space: nowrap;
        padding: 12px 15px;
        background: #333333; }
      .top-bar-section .dropdown li label {
        white-space: nowrap;
        background: #333333; }
      .top-bar-section .dropdown li .dropdown {
        left: 100%;
        top: 0; }
    .top-bar-section > ul > .divider, .top-bar-section > ul > [role="separator"] {
      border-bottom: none;
      border-top: none;
      border-right: solid 1px #4d4d4d;
      clear: none;
      height: 45px;
      width: 0; }
    .top-bar-section .has-form {
      background: #333333;
      padding: 0 15px;
      height: 45px; }
    .top-bar-section ul.right li .dropdown {
      left: auto;
      right: 0; }
      .top-bar-section ul.right li .dropdown li .dropdown {
        right: 100%; }

  .no-js .top-bar-section ul li:hover > a {
    background: #272727;
    color: white; }
  .no-js .top-bar-section ul li:active > a {
    background: #2ba6cb;
    color: white; }
  .no-js .top-bar-section .has-dropdown:hover > .dropdown {
    display: block; }
}

您必须找到上面的代码,只需更改这个媒体查询,以更改顶部的断点。

票数 7
EN

Stack Overflow用户

发布于 2013-12-02 19:11:45

好的,我想在SCSS编译后我已经将CSS的更改固定在一起了。

在CSS中搜索.top-bar并查找与下面类似的条目,并根据需要更改"981px“:

代码语言:javascript
复制
@media only screen and (min-width: 981px) {
.top-bar {
    background: linear-gradient(to bottom, #7d7d7d 0%, #646464 100%);
    *zoom: 1;
    overflow: visible
}

在CSS中搜索meta.foundation-mq-topbar并根据需要更改"981px“:

代码语言:javascript
复制
meta.foundation-mq-topbar {
    font-family: "/only screen and (min-width: 981px)/";
    width: 981px
}
票数 2
EN

Stack Overflow用户

发布于 2014-01-03 07:05:44

基本上,我在读了Parhum的解决方案之后,做了些什么来使它起作用。搜索

元。基础-mq-顶板。应该有一个与之相对应的宽度,在我的例子中,也就是必须更改的40.063em.This宽度。现在,查找相应的媒体查询(即@media only screen和(min- width :40.063em))更改这两行中的两个宽度。现在应该可以用了。

代码语言:javascript
复制
meta.foundation-mq-topbar {
font-family: "/only screen and (min-width:64.00em)/";
width: 64.00em !the width of this must change; }

@media only screen and (min-width: 64.00em) {
.top-bar {
background: #333333;
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20218029

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档