【问题标题】:rails5-bootstrap-sass navbar responsiveness not workingrails5-bootstrap-sass 导航栏响应不工作
【发布时间】:2016-08-03 05:44:04
【问题描述】:

为什么 navbar responsiveness 在 Rails 5 上不起作用。我正在使用bootstrap-sass gem。我已经在互联网上搜索并尝试了可能的解决方案,但我没有运气。

这是我的/app/assets/stylesheets/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 other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 * 
 *
 */

@import "bootstrap-sprockets";
@import "bootstrap";

非常感谢任何帮助!

谢谢,

【问题讨论】:

  • 您是否在您的application.js too? 中添加了//= require bootstrap-sprockets
  • 不,我添加了//= require bootstrap
  • 你只需要//= require bootstrap-sprockets in application.js
  • 我已经将它从 require bootstrap 更改为 require bootstrap-sprockets 仍然没有运气。

标签: css sass navbar ruby-on-rails-5 bootstrap-sass


【解决方案1】:

我之前也遇到过同样的问题。我通过在application.html.erbhead 中添加这两行来解决它

<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

【讨论】:

    猜你喜欢
    • 2018-04-15
    • 1970-01-01
    • 1970-01-01
    • 2013-01-29
    • 1970-01-01
    • 2018-02-20
    • 2021-03-14
    • 2019-06-19
    相关资源
    最近更新 更多