In CSS, i have seen different developers using various methods to specify colors, say for example i have a DIV like
<div class="container"> </div>
CSS
.container
{
background-color:#FFFFFF;
}
or
.container
{
background-color:#ffffff;
}
or
.container
{
background-color:#FFF;
}
or
.container
{
background-color:#fff;
}
or
.container
{
background-color:white;
}
I would like to know what is the best way to use colors in CSS. Thanks in advance
I always use full Hex code e.g : #3c3c3c , #212121 etc It is a good Practice to use proper hex codes. Also Names of color can be used if you know the color better and don't need the hex code for it. Easy work.
Use :
.container{
background-color: #ffffff ; /* or */
background-color: white;
}
RGB abd RGBA can also be used but most of the designer prefer HEX short and easy to remind. I use RGBA for Transparent color.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With