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

CSSで画像にぼかし(ブラー)をかける方法

Posted at

##CSSで画像にブラーをかける方法

クラス付与でぼかしを入れる方法は、

HTML.css
.blur{
  -ms-filter: blur(6px);
      filter: blur(6px);
}

と定義すればOK。

背景だけにブラーをかけたい場合は、beforeを用いて、

HTML.css
.blur{
  background: url(imageURL) no-repeat center;
  background-size: cover;
  position: relative;
  overflow: hidden;
}
.blur:before{
  content: '';
  z-index: -1;
  -webkit-filter: blur(5px);
  -moz-filter: blur(5px);
  -o-filter: blur(px);
  -ms-filter: blur(5px);
  filter: blur(5px);
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  z-index: -1;
}
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?