【#100DaysofCode】Day23 「Railsチュートリアル」 4章 & 5章
慣れてきてしまったので、サクッと終わらして早くアプリ制作に移りたい
Day23
「Railsチュートリアル」 4章 & 5章 レイアウトの作成
4章 Rails風味のRubyは特に書くことなし。
「作りながら学ぶRuby入門」をやってたおかげだな。
5章 レイアウトの作成: bootstrapの導入
今日のポイント
- GemFileに bootstrapを導入する
source 'https://rubygems.org' gem 'rails', '5.1.6' gem 'bootstrap-sass', '3.3.7' . . .
- 全てのページに共通するCSSを追加する
# /app/assets/stylesheets/custom.scss @import "bootstrap-sprockets"; @import "bootstrap"; /* universal */ body { padding-top: 60px; } section { overflow: auto; } textarea { resize: vertical; } .center { text-align: center; } .center h1 { margin-bottom: 10px; }
# /app/assets/stylesheets/custom.scss @import "bootstrap-sprockets"; @import "bootstrap"; . . . /* typography */ h1, h2, h3, h4, h5, h6 { line-height: 1; } h1 { font-size: 3em; letter-spacing: -2px; margin-bottom: 30px; text-align: center; } h2 { font-size: 1.2em; letter-spacing: -1px; margin-bottom: 30px; text-align: center; font-weight: normal; color: #777; } p { font-size: 1.1em; line-height: 1.7em; }
あとは同様にして、bootstrapを利用していく