What Does the 8-Digit CSS Hex Color Code Represent?

Introduced in the CSS Colors Module Level 4 specification, the new 8-digit notation for hexadecimal color code adds an extra two characters at the end for (optionally) specifying alpha channel information. This syntax has good support among modern browsers. It has the following format:

#RRGGBBAA

In this form, the alpha channel values are specified in hexadecimal number format. They range between 0 (the minimum value) and f (the maximum value). For example, the following shows different values applied to the alpha channel of the color #0000ff:

#0000ff00; // 0 opacity
#0000ff40; // 25% opacity
#0000ff80; // 50% opacity
#0000ffbf; // 75% opacity
#0000ffff; // 100% opacity

Since the values are in hexadecimal number format, 40 represents 25%, 80 represents 50%, and so on. For a complete list of possible values for the alpha channel, refer to the following:





This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.