LoginSignup
16
7

More than 5 years have passed since last update.

【Sass学習メモ】active, hoverの記述を入れ子で記述する

Posted at

やりたいこと

active, hoverの記述を入れ子で記述する

解決策

styleshet.css
.button:hover {
      opacity: 1;
    }

.button:active {
      box-shadow: none;
    }
}
styleshet.scss
.button {
    &:hover {
      opacity: 1;
    }
    &:active {
      position: relative;
      top: 7px;
      box-shadow: none;
    }
}

入れ子で書く場合は、&でつなぐことで実現できる。

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