【发布时间】:2016-02-01 18:12:56
【问题描述】:
我正在尝试使用引导程序进行媒体查询。我把它放在我的 application.css.scss 文件中,但这不起作用:
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require 'masonry/transitions'
*= require_tree
*= require_self
*/
@import "bootstrap-sprockets";
@import "bootstrap";
@import "font-awesome";
$backgroundNav : #ffffff;
$backgroundBody : #E9E9E9;
$red : #FD0E48;
@media screen and (max-width: 770px){
.body {
background-color: red;
}
}
body {
background: $backgroundBody;
}
我应该怎么做才能使查询被检测到?
【问题讨论】:
-
你把这些风格送给了谁?元素选择器在哪里?
-
你的风格应该可以。检查元素,看看是否有东西覆盖了这些样式。
-
在我的检查中没什么特别的,背景保留了我在 application.css.scss 中为我的 .post 设置的背景颜色#ffffff
-
@jmcastel,你的
application.css.scss中有字符串*= require_tree .和*= require_self吗? -
@IgorIvancha 是的,请查看我对完整文件的编辑
标签: ruby-on-rails twitter-bootstrap-3 media-queries bootstrap-sass