1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

RailsにBootstrapを導入して練習

1
Posted at

参考元
http://i-b-c.jp/how/cloud9/rubyrails%E3%81%B8-bootstrap-%E5%B0%8E%E5%85%A5/

まず適当に新しいアプリケーションを作成

rails new hello_bootstrap

bootstrapのgemをインストール
Gemfileを開いてgem追加

vi Gemfile
gem 'bootstrap-sass'
bundle install

app/assets/stylesheets/application.cssを
~/application.scssにリネーム

以下のコードを追加

~/application.scss
@import "bootstrap-sprockets";
@import "bootstrap";

続いて
app/assets/javascripts/application.jsに以下のコードを追加

app/assets/javascripts/application.js
//= require bootstrap-sprockets

以上でbootstrapの設定は完了

適当にviewをつくり確認していく

rails g controller home top
top.html.erb
<div id="header" style="background:black;">header</div>
<div class="row">
	<div class="col-sm-4" style="background-color:blue">Main 1 </div>
	<div class="col-sm-4" style="background-color:yellow">Main 2 </div>
	<div class="col-sm-4" style="background-color:red">Main 3 </div>
</div>

上記のコードはdotinstallから参照

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?