Question

I was asked this questiin in an Interview.I know how to convert from RGB to Hex Value.But I am not sure what is the benefit of doing it.

Was it helpful?

Solution

Answer here?

Hex values are easier to copy and paste from image editors, normally easier to remember as it's only 6 digits and can easily become more compact, e.g. #fff vs rgb(255,255,255)

OTHER TIPS

It's a bit more compact, and I suppose that you can identify 'websafe' colors easily. i.e. anything that follows the format of #xxyyzz.

i prefer to use hex as these use less characters and are more difficult to remember. its best to use the shortest method especially if you plan on compressing your css. hex is more web friendly as well.

With RGB you can define also the transparency of a color.

(0.5) = 50% transparent color:rgba(255, 255, 255,0.5)

(1) = 100% transparency = not transparent color:rgb(255, 255, 255,0.5)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top