【发布时间】:2018-02-17 00:18:49
【问题描述】:
我发现了
color: rgb(51, 51, 51);
和
color: #333333;
和
color: black; opacity: 0.8;
都产生等效的灰色阴影。
我如何概括这一点?
换句话说,给定任意的 RGB 或 HEX 颜色/灰色阴影,当color: black; 时,我如何确定opacity 的等效值?
<style>
div {
font-family: sans-serif;
font-size: 48px;
margin: 20px;
padding: 60px;
}
.rgb {
color: rgb(51, 51, 51); /* given this value... */
}
.hex {
color: #333333; /* ...or given this value */
}
.opacity {
color: black;
opacity: 0.8; /* how can I determine this value? */
}
<style>
<body>
<div class="rgb">rgb(51, 51, 51)</div>
<div class="hex">hex #333333</div>
<div class="opacity">opacity 0.8</div>
</body>
【问题讨论】:
标签: css colors hex rgb opacity