This forum is now read-only. Please use our new forums at discuss.codecademy.com.

CSS: An Overview Forum

View Course » View Exercise

1214 points
Df7e7a3af5da99696d088db91bc7cb36?s=140&d=retro
Submitted by
UmTheMuse
about 3 years ago

I can't get the color to work

My exercise is working, except one part: the color. I know that it can't be the code because when I change the color everything works properly. Obviously, I can simply skip to the next section, but I was wondering if there's another fix (download new palettes?). It's weird; I thought all the colors would be available on just about any browser/computer. FWIW, I'm using Chrome.


0 votes

permalink

You don't need to download a new color palette or anything, you just need to give your colors in a form that the browser can understand. I prefer using the rgba() (Red Green Blue Alpha) format, where for black you would do this: rgba(0, 0, 0, 1), and red is rgba(255, 0, 0, 1). Unfortunantly, I don't know of any place that teaches it clearly, but the hex format is much simpler. It also goes Red Green Blue, and you can find a color picker here. I know I didn't explain any of that very clearly, so if you want me to explain a certain part in more detail, please let me know.

2818 points
5674c6dae39efec455000434_879409444
Submitted by
Zeke Y
about 3 years ago

2 Comments

Df7e7a3af5da99696d088db91bc7cb36?s=140&d=retro UmTheMuse about 3 years ago

Thank you, you're answer was clear enough for me to understand. After using your site, I realized that my colors were working right and there was no good reason that I couldn't pass the lesson (I got rid of an extra space and then passed).

I was curious about something, though. You say that you prefer rgba() format over hex, even though hex is much simpler (your words, not mine). Care to explain why?

5674c6dae39efec455000434_879409444 Zeke Y about 3 years ago

Since the comments on the Q&A forums don't allow formatting, I'm going to make a new response to your question.


0 votes

permalink

Here's why I prefer rgba() over hex (#) values: rgba() allows an alpha channel, which offers some functionality that hex can't . For instance, recently I was changing the ::selection color of a website to #000. Chrome made it be a good-looking dark gray, but Firefox made it be black. I tried using opacity in my CSS to change it, but that changed the color of the highlighted text also. Using rgba(), I was able to change just the background color and get it looking almost as good as on Chrome.
Let me know if you've got any more questions!

2818 points
5674c6dae39efec455000434_879409444
Submitted by
Zeke Y
about 3 years ago