简体   繁体   English

Rails应用程序中的间歇性功能Twitter Bootstrap

[英]Intermittently functional Twitter Bootstrap in a Rails App

The first one is an attempt to center some text. 第一个是尝试使某些文本居中。 Even if you replace the offset from 2 to, say, 5, it doesn't move the text to any different position. 即使将偏移量从2替换为5,它也不会将文本移到任何其他位置。

在此处输入图片说明

Here you can see a situation where all I did is change the html text in the first image to something with a different Bootstrap style - in this case, it's the warning stuff. 在这里,您会看到一种情况,我要做的就是将第一张图片中的html文本更改为具有不同Bootstrap样式的内容-在这种情况下,这是警告。 This all works fine. 这一切都很好。 I got the offset and grid stuff straight from the Bootstrap docs - what's going on? 我直接从Bootstrap文档中获取了offset和grid的东西-怎么回事? Thanks 谢谢

在此处输入图片说明

Edit - the app's on Github here: https://github.com/MaxPleaner/mystery 编辑-该应用程序位于Github上: https : //github.com/MaxPleaner/mystery

Edit - I realize that I made a mistake by using col-md in the above example and expecting the style to work on all screen sizes. 编辑-我意识到我在上面的示例中使用col-md并期望样式在所有屏幕尺寸上都能工作,这是一个错误。 However, I tried changing it to col-xs and it doesn't work either. 但是,我尝试将其更改为col-xs,但也不起作用。 See below. 见下文。

在此处输入图片说明

I haven't used that gem from thomas Mcdonald before. 我以前从未使用过托马斯·麦克唐纳(Thomas Mcdonald)的那颗宝石。 According to that you just need to bundle install and restart rails server for assets to be available. 据此,您只需要捆绑安装并重新启动Rails服务器即可使用资产。

I use the gem: 我使用宝石:

      gem 'anjlab-bootstrap-rails', :require => 'bootstrap-rails', :github => 'anjlab/bootstrap-rails', :branch => '3.0.0'

I also noticed that you didn't include bootstrap in your application.js file, which in my case I used - 我还注意到您在application.js文件中没有包含引导程序,在我的情况下,我使用了-

     //= require twitter/bootstrap 

I see that you have require bootstrap in your application.css.scss file and I assume your gem is serving the assets that you need and will be using the homepage.css.scss in the tree to override bootstrap. 我看到您的application.css.scss文件中有需要bootstrap的信息,并且我假设您的gem正在提供您需要的资产,并且将使用树中的homepage.css.scss覆盖bootstrap。 So that should be okay. 所以应该没关系。

You do seem to have access to the grid so it seems to be loading bootstrap fine. 您似乎确实可以访问网格,因此似乎可以很好地加载引导程序。

As for your column issue: 至于您的专栏问题:

col-xs tells the columns not to stack and the columns will remain side-by-side. col-xs告诉列不要堆叠,并且列将并排保留。 They still behave responsive as far as conforming to device size via media query. 只要通过媒体查询符合设备大小,它们仍然会做出响应。 col-md will stack the columns one-on-top of the other. col-md会将列彼此堆叠。

Look more into the the examples out there. 查看更多示例。 You're working with a 12 column grid system. 您正在使用12列网格系统。 Try pasting over some sample code from examples to if those shows up correctly. 尝试将示例中的一些示例代码粘贴到示例是否正确显示的地方。

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

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