LoginSignup
0
0

More than 5 years have passed since last update.

【CSSで画像をグレースケール化させる方法】

Posted at
.CSS
img{
-webkit-filter: grayscale(100%);
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");
filter: gray;
}
img:hover {
-webkit-filter: grayscale(0%);
filter: none;
}

JavaScriptで対応する場合 → 参考:GRAYSCALE.JS

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