Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to specify color in CSS? [closed]

Tags:

html

css

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

like image 850
Shareer Avatar asked Aug 21 '15 05:08

Shareer


1 Answers

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.

like image 89
Vinayak Avatar answered Sep 28 '22 08:09

Vinayak