Open In App

CSS 8 Digit Hex Color

Improve
Improve
Like Article
Like
Save
Share
Report

The Eight Digit Hex color is as simple as Six Digit Hex color it contains 8 digits rather than six, it is used to define the color of your elements with the CSS. It has a prefixed hash(#) value before the digits like six-digit hex code. The difference between 6 and 8-digit hex codes is, that 2 extra characters define the alpha channel as the name suggests in the 8 digit hex color. The last two digits will define that the color will how much transparent or opaque. If the last two digit is 00 then that will be fully transparent and if that is FF then it will be fully opaque. 

Syntax:

#RRGGBBAA

Note: The first six characters represent the RGB color as Six digit hex color code. The last two represent the alpha channel. 

Example 1: In this example, we are using CSS 8 Digit Hex Color property.

html




<!DOCTYPE html>
<html>
<head>
    <title>CSS 8 Digit Hex Color</title>
    <style>
        body {
            background-color: #666600;
        }
 
        h1 {
            color: green;
        }
 
        article {
            background-color: #FFFFFF44;
            border: 5px solid green;
            margin: 15px;
            text-align: center;
        }
    </style>
</head>
 
<body>
    <article>
        <h1>GeeksforGeeks</h1>
    </article>
</body>
</html>


Output:

  

Example 2: here is another example of the above-explained property.

html




<!DOCTYPE html>
<html>
<head>
    <title>CSS 8 Digit Hex Color</title>
 
    <style>
        body {
            background-image: url(
            background-attachment: fixed;
            background-size: cover;
        }
 
        h2 {
            color: white;
        }
 
        article {
            background-color: #FFFFFF22;
            border: 2px solid green;
            background-position: center center;
            text-align: center;
        }
    </style>
</head>
 
<body>
    <article>
        <h2>GeeksforGeeks</h2>
    </article>
</body>
</html>


Output:

 



Last Updated : 09 Jun, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads