Saturday, September 26, 2015

Everything There is to Know About HTML Colors

Hexadecimal Codes

Hexadecimal codes are made up of 6 numbers or letters and follow a hashtag.  They follow the template #RGB, meaning red, green, and blue, and there's two numbers or letters for each color.  The numbers range from 0-6, one being the least color and 6 being the most, and the letters go from A-F, where A is more color than 6 and F is the most. 

For example, here's what the code would 
look like for a div with a black background and white text:


Color Words

Color words are very useful when you don't 
need a specific color.  You can use them 
by simply putting them in place of a color 
code, but be sure not to use any spaces! 
The example to the right shows the code 
of a body with a black background and white 
text using color words.

Here's a chart of a few color words and their hexadecimal codes:





RGB and RGBa

Instead of hexadecimal codes or color words, you can use RGB or RGBa format to get a little but more of a variety in color choice.  The image at the right shows how to switch to RGB or RGBa in dreamweaver when making a CSS rule. RGB is displayed as three numbers in parentheses separated by commas, and RGBa is the same except for a fourth number on the end that will always be between 0 and 1.  That fourth number controls transparency, 0 being completely transparent and 1 being completely opaque.  The code below shows 4 increasingly opaque sections:


Final Product

Here is what the code above looks like over an image.  Now you know how to put color and transparency in your webpages!



Additional Links



1 comment: