LoginSignup
5
6

More than 1 year has passed since last update.

railsにてlink_toの文字色を変える

Posted at

link_toにて各リンク先を作成したが、デフォルトの色が青色なのでこの色を変えたいと思います。
スクリーンショット 2021-05-12 21.02.27.png
これはスキンケア用品に関するクチコミサイトですが、色合いがおかしいです。

やり方は簡単で、link_toの末尾にclass指定して、cssで変更します。

view
<%= link_to category.category_name, categories_path(category_id: category.id) %>
これを、
<%= link_to category.category_name, categories_path(category_id: category.id, class:link) %>
scss
.link {
    text-decoration: none;
    color: white ; 
}

これで文字色の指定ができます。
文字色以外もこのscss上で編集できます。

スクリーンショット 2021-05-12 21.31.44.png

以上、link_to内にclassを作るのがポイントでした。

5
6
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
5
6