1
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.

Sassで擬似要素を書くには

Posted at

環境

Mac OS

やりたいこと

Sassで擬似要素を使いたい

やったこと

::afterの前に&をつけた

.body {
  position: relative;
  width: 80%;
  margin: 90px auto;
  text-align: center;
  &::after{
    position: absolute;
    content: "";
    display: block;
    width: 100%;
    height: 1px;
    bottom: 0;
    background-color: black;
  }
}

要素の下側に線を引きたかったのでこのような記述にしました
クラス名のところを&に変えるだけで良いんですね🤔

1
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
1
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?