0
1

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

CSS で「>」矢印を作る際、IE でゴミが出る

Last updated at Posted at 2017-09-29

以前ハマったくせにすっかり忘れていたので、自分用メモ。
CSS で「>」矢印を作る際、border でショートハンドを用いると、IE において不要な薄い線が発生するケースがある。
arrow.png
こんな具合に、左に薄く線が出る。

これを避ける為には「border-top」「border-right」など個別に設定を行う。

.icon-arrow {
position: relative;
padding: 0 0 0 20px;
}

.icon-arrow:before {
content: '';
position: absolute;
top: 50%;
left: 0;
width: 12px;
height: 12px;
margin-top: -6px;
border-top: 4px solid #000;
border-right: 4px solid #000;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}

どちらの設定でも2行必要だが、「色指定が1箇所で済むし〜」とショートハンドを用いるとハマる。
transform: rotate の角度や表示位置によって出たり出なかったりというのも落とし穴。

/* ダメな例 */
.icon-arrow:before {
..
border: solid #000;
border-width: 4px 4px 0 0;
..
}
0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?