HOW set color - HTML

versions of HTML and XHTML support color setting for text as well as the background-color of the document,frames borders,tables,or even individual table cells. define 16 widely color in html. the color value combining three color values red,green,blue. html colors are defined using two format :--

  • hexadecimal format:(#3322aa)this format begins with a pound sign(#), color value must and with the semicolon(;)

you can change the text color in html using the css 'color:color_value' property.

hex color example - set html h1 tag text, background and border color

       h1{  border:#33ffbb 2px solid;

              color:#3a4b9c;
                       
              background-color:#22ffbb;
               
                /*hexadecimal value for color and background-color*/;
                                        
                                   }
  • the second function/decimal value method :- begin with rgb and encapsulates the color values in parentheses in a comma-separated list. rgb(rrr,ggg,bbb);or  rgb(rrr,ggg,bbb);

:- rrr value for red color , ggg value for green color , bbb value for blue color type

color Tips:

color names and values are case insensitive,so red and red are equivalent,as are #FFAABB  and #ffaabb.

how set text color in html using rgb(rrr,ggg,bbb) method example:

        {          color:rgb(121,222,111);
         
                   background-color : rgb(222,111,232);
        
                   /*--(decimal color value range 0 to 255).--*/   
        
               border:rgb(121,222,333) 1px solid;  }

(16)basic color names:-color names supported by all browsers.

color namehex valuecolor
black #000000 
silver #c0c0c0 
gray #808080 
white #f0ffff 
maroon #800000 
red#ff0000 
purple#800080 
fuchsia#ff00ff 
green#008000 
lime#00ff00 
olive#808000 
yellow#ffff00 
navy#000080 
blue#0000ff 
teal#008080 
aqua#00ffff