0

I'm unsure why these two colours are different. If my assumption is correct, rgb(255,0,0) should be the same as #ff0000 - and since they are the same, should rgba(255,0,0,0.5) also be the same as #ff000050? And if not, why, and what hex code could match the equivalent RGBA code?

Why does this appear to not be the case? See the example below:

p:nth-child(1) {
  color: rgb(255, 0, 0);
}
p:nth-child(2) {
  color: #ff0000;
}
p:nth-child(3) {
  color: rgba(255, 0, 0, 0.5);
}
p:nth-child(4) {
  color: #ff000050;
}
<p>One</p>
<p>Two</p>
<p>Three</p>
<p>Four</p>
user8758206
  • 2,106
  • 4
  • 22
  • 45

0 Answers0