简体   繁体   English

使Bootstrap样式覆盖本机Rails样式

[英]Making Bootstrap styles override native Rails styles

I want Bootstrap styling to always supersede Rails native styling. 我希望Bootstrap样式始终取代Rails本地样式。

The example that's driving this is the following code: 导致此问题的示例如下代码:

link_to "Delete all CIDNE reports", :class => "btn btn-info"

Does not style the link in the button fashion you would expect from Bootstrap. 不会以您期望从Bootstrap中获得的按钮样式来设置链接的样式。 It remains looking like an ordinary generic blue link. 它仍然看起来像一个普通的通用蓝色链接。 How do I ensure Bootstrap styles take precedence? 如何确保Bootstrap样式优先?

Styles are included in order which they're are listed in application.css(sass/scss etc) in your assets folder. 样式按照其在资产文件夹中的application.css(sass / scss等)中列出的顺序列出。 By defaults the whole directory required using require_tree . 默认情况下,使用require_tree .所需的整个目录require_tree . Which means an alphabetical order. 这意味着字母顺序。 And rails only provides you with styles when you do the scaffolding and it gives you scaffold.css. 而且,rails仅在执行脚手架时为您提供样式,并且为您提供scaffold.css。 So if you're including file called bootstrap.css, it should go before that file. 因此,如果要包含名为bootstrap.css的文件,则该文件应位于该文件之前。

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

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