yuzu - 1 year ago 71

CSS Question

I know this question seems to duplicate to How to convert RGB to HTML color?.

However I think the answer tries to teach more than the original question. In fact, I don't understand the answer and can't use it in the actual code.

Please give me the simplest mathematical formula to translate RGB to the form like #fff which I think represents white.

I know the required color is written as R:63,G:81,B:181 in RGB.

`R:63, G:81, B:181`

And I need to translate the RGB into the CSS format.

Please give me exact CSS color code for the color. Plus please give me the simplest mathematical formula for the translation.

Answer

if the rgb in decimal is the only information you have, you don't need to transfer, simply put

```
color: rgb(61, 81, 181)
```

Source (Stackoverflow)