3
0

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 3 years have passed since last update.

Rails link_toで表示された下線を消す方法

Posted at

はじめに

検証機能を使えば分かるがlink_toはaタグ

方法1

aタグだからscssにて

a {
    text-decoration: none;
}

を指定する

方法2

link_toにクラスをつけて

<%= link_to "リンク", path名, class: "link" %>

scssにて指定

.link {
   text-decoration: none;
}

##それでも消えないとき

!importantを付けて優先順位を変更する

方法1の場合

a {
    text-decoration: none !important;
}

方法2の場合

.link {
    text-decoration: none !important;
}

!importantはあくまで最後の手段なので多用は厳禁

3
0
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
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?