COLOR / 050

Alpha transparency

色の透け具合
同じ色でも透明度によって、下の色との重なり方が変わります。

実際のHTML・CSSで描かれた見本です。

ラボで詳しく試す ↗

ひとつ試すなら

どこが変わるかを観察して、似た表現と見比べてみよう。

こんなときに

重なりや、写真の上に色を重ねる場面。

仕組みと使い方

要素全体を薄くするopacityと、色だけに指定するalphaは作用が異なります。

透明透けるalpha重なる
実装コードを見る
<style>
.sample{width:100%;height:100%;min-height:190px;display:grid;place-items:center;position:relative;overflow:hidden;box-sizing:border-box;font-family:Arial,'Hiragino Kaku Gothic ProN',Meiryo,sans-serif;color:#20211d;background:#f1f0e9;padding:22px}.sample *{box-sizing:border-box}.sample button,.sample input,.sample summary{font:inherit}.sample button,.sample summary,.sample label{touch-action:manipulation}.sample :focus-visible{outline:3px solid #6050bf;outline-offset:5px}.sample small{font-size:10px;line-height:1.5}.sample .editable{margin:0}.sample svg{max-width:100%;height:auto}
.sample{background:repeating-conic-gradient(#fff 0% 25%,#dddcd6 0% 50%) 0/20px 20px}.sample .swatches{display:flex;gap:7px}.sample i{width:69px;height:104px;display:grid;place-items:center;font-style:normal;font-size:11px;background:rgb(140 100 210)}.sample i:nth-child(2){background:rgb(140 100 210/.65)}.sample i:nth-child(3){background:rgb(140 100 210/.3)}
</style>
<div class="sample">
<div class="swatches"><i>100%</i><i>65%</i><i>30%</i></div>
</div>