LoginSignup
0
0

More than 3 years have passed since last update.

【CSS】透明度

Posted at

opacity

:sunny: 要素を透明にする
:sunny: 透明度は0.0〜1.0の数値で指定。
:sunny: 0が完全に透明となり1が完全に不透明

透明度を設定しなかったら・・・

例.html
    <div class="one">
      <p>透明度 1.0</p>
    </div>
    <div class="half">
      <p>透明度 0.5</p>
    </div>
    <div class="zero">
      <p>透明度 0</p>
    </div>
例.css
p {
  font-size: 30px;
  background-color: red;
  width: 200px;
  height: 100px;
  float: left;
  margin-right: 10px;
}

スクリーンショット 2019-12-30 0.05.30.png

もちろんこのとおり。
CSSを適用すると

例.css
.one {
  opacity: 1.0;
}

.half {
  opacity: 0.5;
}

.zero {
  opacity: 0;
}

スクリーンショット 2019-12-30 0.14.49.png

このとおり:smile:
透明度0は全て透明になってしまうので、何も映らなくなりました:sweat_smile:

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