CSS | 6 Digit Hex Color

The Six Digit Hex Color is very much popular to define colors in CSS because of the variation of multiple colors is available in the 6 digit hex colors codes. There are Six characters followed by a hash(#) like #RRGGBB. The developer used the hex color codes it is hard enough to remember those to compare with color names like blue, green, cyan, brown, etc because color codes contain so many shades of a single color. By using the hex color codes you have a wide-open field to choose your preferable color for your app or site wherever you want to use them. By color’s name, there are 147 names that you can use but by using hex color code you can get 16 million colors that are the main reason behind the using of hex color codes.
Syntax:

#RRGGBB

Note: Here those 6 character define RGB color which is Red, Green and Blue.
Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

Example 2:



filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.