颜色代码六位十六进制字符_8位十六进制颜色

颜色代码六位十六进制字符

One of the most requested capabilities in my early days of web development was the ability to set opacity on elements and even PNG images without the need for browser-specific CSS or hacks.  Eventually we got native opacity support and even enjoyed rgba(), the ability to cite an opacity level with a color.

在我进行Web开发的初期,最需要的功能之一是无需设置特定浏览器CSS或黑客程序即可在元素甚至PNG图像上设置不透明度的功能。 最终,我们获得了本机不透明度支持,甚至享受了rgba() ,它可以用颜色引用不透明度级别。

While I loved the ability to provide an opacity with color using rgba(), the use of hexadecimal color had always been ingrained in me, which made the sudden need for rgba conversions annoying.  Luckily these days we have 8 digit hex values with allow us to cite an opacity level as the last two characters of the hex value!

虽然我喜欢使用rgba()为颜色提供不透明性的能力,但十六进制颜色使用一直根深蒂固,这使对rgba转换的突然需求变得烦人。 幸运的是,这些天我们有8位十六进制值,允许我们将不透明度级别作为十六进制值的最后两个字符!

CSS (The CSS)

Hex implies "six" but the last two digits of the 8 character hex value are the opacity value:

十六进制表示“六个”,但是8个字符的十六进制值的最后两位是不透明度值:


.myElement {
    /* { red/50% opacity } */
    /* pink of white background */
    background: #ff000080;
}


I love that we can use hexidecimal colors with the additional opacity value; needing to convert to rgba to take advantage of opacity was a needless frustration.  I owe something to the creator of this API!

我喜欢我们可以将十六进制颜色与附加的不透明度值一起使用; 需要转换为rgba以利用不透明性是不必要的挫败感。 我欠这个API的创建者!

翻译自: https://davidwalsh.name/8-digit-hex

颜色代码六位十六进制字符

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值