質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Bootstrap

BootstrapはウェブサイトデザインやUIのWebアプリケーションを素早く 作成する可能なCSSフレームワークです。 Twitter風のデザインを作成することができます。

Q&A

解決済

1回答

3327閲覧

Railsのscssが反映されない

nimi0370

総合スコア47

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Bootstrap

BootstrapはウェブサイトデザインやUIのWebアプリケーションを素早く 作成する可能なCSSフレームワークです。 Twitter風のデザインを作成することができます。

0グッド

0クリップ

投稿2017/03/22 12:06

Ruby on Railsを利用してメディアの作成をしています。
現在デザインを実装しようと思ってます。

共通のscssにcssを記述しているのですが、font-sizeしか反映されず困っています。

application.scss

1@import "bootstrap-sprockets"; 2@import "bootstrap"; 3@import "font-awesome"; 4@import "md_simple_editor"; 5 6body { 7 background-color:white; 8 padding-top: 10px; 9 padding-left: 50px; 10} 11 12.shibuya{ 13 font-size:30px; 14 color:#6f5f39; 15 font-weight:bold; 16 text-decoration-line: none; 17 font-family: "メイリオ", Meiryo; 18} 19 20.shibuya:hover { 21 opacity: 0.8; 22} 23 24.topof{ 25 margin-left:580px; 26} 27 28.log { 29 font-size:10px; 30 color:orange; 31} 32 33 34/* 35 * This is a manifest file that'll be compiled into application.css, which will include all the files 36 * listed below. 37 * 38 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 39 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 40 * 41 * You're free to add application-wide styles to this file and they'll appear at the bottom of the 42 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 43 * files in this directory. Styles in this file should be added after the last require_* statement. 44 * It is generally better to create a new file per style scope. 45 * 46 *= require_tree . 47 *= require jquery-ui/autocomplete 48 *= require jquery.tagit 49 *= require tagit.ui-zendesk 50 *= require_self 51 */ 52

application.html.erb

1<!DOCTYPE html> 2<html> 3 <head> 4 <title>Sweets Maphia</title> 5 <%= csrf_meta_tags %> 6 7 <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 8 <%= include_gon %> 9 <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> 10 </head> 11 12 13 <dl class="searchbox"> 14 <%= search_form_for @search, url: articles_path do |f| %> 15 <dt><%= f.text_field :title_or_content_cont ,placeholder: '検索するテキストを入力...' %></dt> 16 <dd><%= f.submit ('検索') , class: 'search-btn'%></dd> 17 <% end %> 18 </dl> 19 <body> 20 <%= image_tag 'swm.png',:class => 'topof' %> 21 <div class="menu"> 22 <div class="shibuya"> 23 <%= link_to 'SHIBUYA',partial: 'tag_list', tags: Article.tagged_with('渋谷')%> 24 </div> 25 26 <div class="omote"> 27 <%= link_to 'OMOTE-SANDOH',partial: 'tag_list',tags: Article.tagged_with('表参道')%> 28 </div> 29 30 <div class="aoyama"> 31 <%=link_to 'AOYAMA', partial: 'tag_list',tags: Article.tagged_with('青山')%> 32 </div> 33 34 <div class="yokohama"> 35 <%= link_to 'YOKOHAMA',partial: 'tag_list',tags: Article.tagged_with('横浜')%> 36 </div> 37 38 <div class="others"> 39 <%=link_to 'OTHERS',partial: 'tag_list',tags: Article.tagged_with('その他')%> 40 </div> 41 </div> 42 <p class="notice"><%= notice %></p> 43 <p class="alert"><%= alert %></p> 44 <%= yield %> 45 </body> 46</html> 47

個人的には先に導入したBootstrapが原因かなと思い、Bootstrapを外すことも試みたのですがうまくいかず断念しました。わかる方いらっしゃいましたらよろしくお願いします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

Bootstrapが原因ではありませんでした。
Bootstrapを無効にする方法は、application.jsとapplication.scssのbootstrapに関する記述を削除した後に、Gemfileから gem bootstrap-sassを削除します。

最後にgem uninstall bootstrap-sassを行います。この後エラーが出る場合は、Gemfile.lockを削除後にbundleを行います。

これでBootstrapを無効にすることができます。

投稿2017/03/24 07:01

nimi0370

総合スコア47

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問