Firefox parsing 4 digit hex color values as rgba

前端 未结 2 404
孤独总比滥情好
孤独总比滥情好 2021-01-28 03:41

Recently observed (by accident) that Firefox (I\'m using v49) is parsing 4 digit hex colors as rgba. Reading up on the CSS spec, I don\'t see any mention of support for this an

2条回答
  •  野的像风
    2021-01-28 04:03

    This is new to Color level 4 (which is why it doesn't appear in level 3) and was indeed shipped in Firefox 49:

    8 digits
    The first 6 digits are interpreted identically to the 6-digit notation. The last pair of digits, interpreted as a hexadecimal number, specifies the alpha channel of the color, where 00 represents a fully transparent color and ff represent a fully opaque color.

    4 digits
    This is a shorter variant of the 8-digit notation, "expanded" in the same way as the 3-digit notation is. The first digit, interpreted as a hexadecimal number, specifies the red channel of the color, where 0 represents the minimum value and f represents the maximum. The next three digits represent the green, blue, and alpha channels, respectively.

提交回复
热议问题