yuzu - 7 months ago 21

CSS Question

I changed the title so that it will be more clear in the difference from the duplicate questions.

Let me explain how this question is different from RGB to Hex and Hex to RGB

The previous question is for the general purpose. However this question is only for uses in css. Please understand that many of the readers of this question do not understand the answers of the previous question. Me too.

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)
```