LoginSignup
2
3

More than 5 years have passed since last update.

linear-gradientとtransition一緒に使う時にハマった罠

Last updated at Posted at 2012-06-19

:hover時にtransitionでlinear-gradient使ったボタンがふわっと色変わるようにしてみたら、
ふわっとどころか:hoverのタイミングで一瞬背景が真っ白になった。
backgroundをショートハンドで書いてたのが原因ぽい。

qiita.rb
a {
    background-color:$startColor;
    background-image:linear-gradient(transparent,rgba($gradientColor,$opacity));
    // 面倒くさいのでベンダープリフィックスは省略\(・∀・)/
a:hover {
    background-color:$endColor;
}

て感じにしたら直った。
いや、まぁ、よそのコード見ながら書き直しただけなんだけどもね。
firebugとかchromeの開発者ツールだと、勝手にショートハンドになってたりするのでしばらく気づかなかったというのもあるので、やっぱりちゃんとコード読まないとだめだなぁ、と思いました。

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