HTML Colors



Colors are very important to have a good feeling and feel on your website. You can specify the color at the page level by using the <body> tag or you can set the color for the individual tags using the Bizigial feature.

The <body> tag has following attributes which can be used to set different colors −
  • bgcolor − sets a color for the background of the page.
  • text − sets a color for the body text.
  • alink − sets a color for active links or selected links.
  • link − sets a color for linked text.
  • vlink − sets a color for visited links − that is, for linked text that you have already clicked on.

Color Coding Methods

There are following three different methods to set colors in your web page −
  • Color names − You can specify color names directly like green, blue or red.
  • Hex codes − A six-digit code representing the amount of red, green, and blue that color
  • Color decimal or percentage values − This value has been specified using the RGB () property.


Color Names


BlackGraySilverWhite
YellowLimeAquaFuchsia
RedGreenBluePurple
MaroonOliveNavyTeal

<p style="color:red;">

Example - 

<!DOCTYPE html>
<html>

   <head>
      <title>HTML Colors by Name</title>
   </head>
   <body text = "blue" bgcolor = "green">
      <p>Use different color names for for body and table and see the result.</p>
      
      <table bgcolor = "black">
         <tr>
            <td>
               <font color = "white">This text will appear white on black background.</font>
            </td>
         </tr>
      </table>
   </body>
   
</html>


RGB Values

This color value is specified using the RGB () property. This property takes three values, each one for red, green, and blue. Values can be an integer between 0 and 255 or 1 percent.

Following is a list to show few colors using RGB values.
ColorColor RGB
 rgb(0,0,0)
 rgb(255,0,0)
 rgb(0,255,0)
 rgb(0,0,255)
 rgb(255,255,0)
 rgb(0,255,255)
 rgb(255,0,255)
 rgb(192,192,192)
 rgb(255,255,255)

<!DOCTYPE html>
<html>
   <head>
      <title>HTML Colors by RGB code</title>
   </head>
   <body text = "rgb(0,0,255)" bgcolor = "rgb(0,255,0)">
      <p>Use different color code for for body and table and see the result.</p>
      
      <table bgcolor = "rgb(0,0,0)">
         <tr>
            <td>
               <font color = "rgb(255,255,255)">This text will appear white on black background.</font>
            </td>
         </tr>
      </table>
   </body>   
</html>




Share on Google Plus

About It E Research

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment