LoginSignup
0
0

More than 3 years have passed since last update.

liタグで作成したリンクの下線がtext-decorationで消せない

Last updated at Posted at 2020-08-10

はじめに

前提条件
railsでのアプリケーション作成

エラー?

下記のように確かにliタグに対してtext-decorationを設定しているのに適用されない

application.html.erb
<ul class="lists">
 <li class="list"><%= link_to "エクササイズ", "#" %></li>
</ul>
application.scss
.lists {
  display: flex;
  align-items: center;
  list-style: none;
}

.list {
  padding: 1px 20px;
  border-right: 1px solid black;
  text-decoration: none;
  color: #433f3f;
}

解決方法

liタグではなくlink_toメソッドにclassを設定

application.html.erb
<ul class="lists">
 <li><%= link_to "エクササイズ", "#", class: "list" %></li>
</ul>

scssは特に変更する必要なし

これでliタグ内のリンクの下線を消せるようになると思います。

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