简体   繁体   English

在Rails中覆盖Zurb Foundation CSS

[英]Override Zurb Foundation css in Rails

I can't override the class " .fixed " in foundation_and_overrides.scss because the class "fixed" doesn't exist on that file, I searched it everywhere (ctrl + f on " fixed ") 我无法在foundation_and_overrides.scss覆盖类“ .fixed ”,因为该文件中不存在类“ fixed”,所以我到处都搜索了它(“ fixed ”上的ctrl + f)

Or, I need to set its value "left" to none instead of "0". 或者,我需要将其值“ left”设置为none而不是“ 0”。 I don't know how to do it, I've already tried to override the css class directly on my header, or in application.css, but it doesn't work, I suspect the compiled foundation_and_overrides.css to takes the priority. 我不知道该怎么做,我已经尝试过直接在标头或application.css中覆盖css类,但是它不起作用,我怀疑已编译的foundation_and_overrides.css具有优先权。

Also, I cannot change its value directly on the html element, because the javascript associated when scrolling destroy its css data. 另外,我不能直接在html元素上更改其值,因为滚动时关联的javascript破坏了其CSS数据。 麦哲伦不能覆盖 my html: 我的html:

<div data-magellan-expedition="fixed">
  <dl class="sub-nav">
    <dd>
      <a href="/en/login">
        Log in
      </a>
    </dd>
    <dd class="active">
      <a href="/en/signin">
        Sign up
      </a>
    </dd>
  </dl>
</div>

What the inspect element of chrome tells me: chrome的inspect元素告诉我的是:

enmedia="screen"  http://0.0.0.0:3000/assets/foundation_and_overrides.css?body=1:4367
.fixed {
  width: 100%;
  left: 0;
  position: fixed;
  top: 0;
  z-index: 99;
}

I cannot create a new class, and copy the "fixed" attribrutes there, I already tried it, on such case I also need to copy x classes because the fixed attributes are parents of others attributes. 我无法创建一个新类,并且已经在其中复制了“固定”属性,在这种情况下,我还需要复制x个类,因为固定属性是其他属性的父级。

Class .fixed from top-bar components: https://github.com/zurb/foundation/blob/master/scss/foundation/components/_top-bar.scss 从顶部栏组件修复的类.https: //github.com/zurb/foundation/blob/master/scss/foundation/components/_top-bar.scss

there are two ways: 有两种方法:
1. Set variables $include-html-top-bar-classes: false if you don't need the top-bar component 1.设置变量$ include-html-top-bar-classes:如果不需要顶栏组件,则返回false
2. Add some class with styles .your-class{left: none;} at the end of your styles and overwrite default .fixed 2.在样式的末尾添加一些样式为.your-class {left:none;}的类,并覆盖默认的.fixed

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM