如何将bootstrap.css加载到rails3应用程序?

如何将bootstrap.css加载到rails3应用程序?,css,ruby-on-rails-3,ruby-on-rails-3.2,Css,Ruby On Rails 3,Ruby On Rails 3.2,我不想问这个问题。 现在,我有了rails应用程序,它运行良好,外观良好。 我想添加bootstrap的圆角样式搜索框。 所以我补充说 :class=>“表单搜索” 及 :class=>“输入媒体搜索查询” 形成标签 但它没有改变:(它仍然只是一个方形的盒子。 为什么它没有改变?我怎样才能使它像官方引导网站中的圆角搜索框一样 让我给你更多关于我的配置的信息。谢谢 归档 gem'twitter引导程序rails' 在assets/javascripts/I中有'bootstrap.js.coffe

我不想问这个问题。 现在,我有了rails应用程序,它运行良好,外观良好。 我想添加bootstrap的圆角样式搜索框。 所以我补充说

:class=>“表单搜索”

:class=>“输入媒体搜索查询”

形成标签

但它没有改变:(它仍然只是一个方形的盒子。 为什么它没有改变?我怎样才能使它像官方引导网站中的圆角搜索框一样

让我给你更多关于我的配置的信息。谢谢

归档

gem'twitter引导程序rails'

在assets/javascripts/I中有'bootstrap.js.coffee'

application.js以

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require_tree .
//= require jquery.ui.datepicker
/*
 * 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 vendor/assets/stylesheets of plugins, if any, 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 top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require_self
 *= require_tree .
 *= require jquery.ui.datepicker
 */
在assets/stylesheets/I中有“bootstrap\u和\u overrides.css.less”

而application.css以

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require_tree .
//= require jquery.ui.datepicker
/*
 * 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 vendor/assets/stylesheets of plugins, if any, 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 top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require_self
 *= require_tree .
 *= require jquery.ui.datepicker
 */

我和你经历过同样的事情

我想我找到了问题所在

将此添加到html的顶部

<!DOCTYPE html>

以及以下形式:

<form class="form-search">
  <input type="text" class="input-medium search-query">
  <button type="submit" class="btn">Search</button>
</form>

搜寻

请让我知道这是否有效。首先,请确保从引导程序项目主页下载

第二,您需要的所有文件是:

  • bootstrap.css不是最小版本,因为您稍后会更改它

  • bootstrap.min.js,因为您不可能更改它

  • 加载的img文件夹中的两个png图像文件

  • 3.将它们放入资产文件夹的相关文件夹中


    第四,如果你想让图标显示出来。你必须将bootstrap.css中图标png文件的引用uri更改为当前文件夹结构,这两个文件夹都可以。

    add*=需要bootstrap\u和\u覆盖到application.css,或者你可以使用单个组件试试这些@kapanjadimood谢谢!我试过了,但没有改变我的搜索b牛的外形:(这太奇怪了。最简单的方法是下载JU和CSS文件的编译版本,然后放到你的资产文件夹中。Gem和其他东西真的不重要。@Still.Wang谢谢你的建议。我确实在资产文件夹中添加了官方bootstrap.CSS和bootstrap-responsive.CSS。但是,有趣的是,它根本不做响应性设计。)当我缩小窗口大小时,它也不再显示引导图标:(我的意思是,如果有人按照上的说明,尝试使用表单搜索类,你就会明白我在说什么。样式更改,但搜索框:(