In this MDN documentation I find a huge list of color names that can be used in CSS with their respective values in hexadecimal. For example:
--------------------------------------
| nome em En | nome em Pt | hexa |
--------------------------------------
| black | preto | #000000 |
--------------------------------------
| silver | prata | #c0c0c0 |
--------------------------------------
| white | branco | #ffffff |
--------------------------------------
| red | vermelho | #ff0000 |
--------------------------------------
To apply a red background ( red
) to a div
I could use:
usando o nome da cor: usando valor hexadecimal:
div{ div{
background-color: red; OU background-color: #ff0000;
} }
Or using RGB:
div{
background-color: rgb(255, 0, 0);
}
Personally I find it much more practical to use red
than #ff0000
, and apparently I've never encountered problems using names, but I'm not 100% sure if this is a good practice or there is a problem between browsers.
My question is whether I can only use color names instead of the hexadecimal or RGB value, and whether this implies some kind of browser mismatch. Which would be the most recommended to use and why?