FAQ: CSS Color - Hexadecimal

This community-built FAQ covers the “Hexadecimal” exercise from the lesson “CSS Color”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn CSS

FAQs on the exercise Hexadecimal

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Whats is the difference between Hexadecimal colors and just colors by names and when to use which?

1 Like

well, Hexadecimal colors allows us to choice from 16 million colors (255 shades of red, green and blue), while the there are only a couple dozen of color keywords.

4 Likes

Assuming we’re happy using some or all of the colours from keywords (and don’t need the extra choice), is there any advantage to using the hexcode instead?

to make a good looking website, i don’t think you can get away with just the color keyword, that are only a handful.

I’ve noticed that often times in the lessons, h3 or even h4 tags will be styled in css to have larger font sizes than the h2’s.

Is this an oversight or an example of using html tags for there semantic meaning as opposed to their styling?

2 Likes

The lesson states:

Keep in mind that all three character hex colors can be represented with six characters (by repeating each character twice) but the same is not true in reverse.

I’m confused about what is being referred to with but the same is not true in reverse. Isn’t the whole point that it IS true in reverse? That those three colours can be represented with three OR six characters?

1 Like

It isn’t talking about three colors. It is referring to “three-character hex colors”. For all hex colors whose number pairs are the same characters (such as #000000 or #11AACC or #CCDD55 or #AA3377 and many more), you have a choice: You can either write them as six characters or you can shorten them into the equivalent three-character representation (i.e. #000, #1AC, #CD5, #A37 for the examples I just cited earlier).
So three-character hex colors can be written as six-character hex codes, but the reverse isn’t necessarily true. There are many six-character hex colors which can’t be shortened into three-character representation. For example, #1A9D3F or #3195B2 and so on. These colors don’t have same-character number pairs.

3 Likes

Ah okay. I figured that was kinda obvious since the whole per-requisite for using 3 character hex colours was that their 6 character variants had repetition so I thought this was getting at something else. Appreciate the clarification!

Is there a reason to use uppercase letters for hexadecimal CSS color values?

1 Like

It seems to be an issue of personal preference.

Is it worth it to dedicate time to truly understand rgb and hex, knowing that you can look at different rgb codes at google, or use a tool to get the exact color?

It is worth it to understand the exact makeup, yes. How well does one understand Hex? Can we convert it to decimal?

rgb(255, 255, 0)  =>  #FFFF00

Once we truly understand it doesn’t matter what resources we equip ourselves with, we will understand them, too.

1 Like

This may be a dumb question, but is there a centralized location for all the hexadecimal codes for the colors? I’m not naturally a designer, so I normally like to see which color (and eventually sub-color) looks good before settling on the right choice for me. Reading previous replies helped me understand the necessity of hexadecimal but cannot lie when I say how intimidating it can be trying to remember the codes for a specific hexadecimal color versus just color: turquoise.

You can find a list of colors built into CSS here and their corresponding hex values. To get costume hex colors I recommend searching hex color on google and using their tool.

Thank you so much for these resources!

When building a project, which of the color property is most preferred and easy to use? The Hexadecimal or Name color

It might be best to do some reading on how well named colors are supported by user agents (client browsers). We can assume it is universally supported, but, that is assumption. What we do know with full confidence is that Hex and RGB are fully supported across the board. Which is the safer bet?

1 Like