Marcus Pohl Home Marcus Pohl Home
Marcus Pohl Home
Resume
Portfolio
Web Tutorials
For Friends
Contact
Marcus Pohl Home

Style Sheets - Color/Backgrounds

What's a Web site without a dash of color? Boring. That's why this section is important. Here you learn about the following properties: color, background-color and background-image. Let's start with the obvious, color.

The color property can work on many objects including: text, the body and links (we'll cover this in the review section). To specify a color, you have several different options: rgb (for you Photoshop users), hexidecimal code (for HTML veterans who don't use rgb), and text color names (for most people). The following table is a listing of some colors you might want to use. Note: For the below colors, you can use their text names, but I'd be skeptical about using other color names, some browsers won't support them.

Color RGB Hexidecimal Sample
aqua (0,255,255) #00FFFF  
black (0,0,0) #000000  
blue (0,0,255) #0000FF  
fuchsia (255,0,255) #FF00FF  
gray (128,128,128) #808080  
green (0,128,0) #008000  
lime (0,255,0) #00FF00  
maroon (128,0,0) #800000  
navy (0,0,128) #000080
olive (128,128,0) #808000  
purple (128,0,128) #800080  
red (255,0,0) #FF0000  
silver (192,192,192) #C0C0C0  
teal (0,128,128) #008080  
white (255,255,255) #FFFFFF  
yellow (255,255,0) #FFFF00  

Here's some examples of the code you could use:

p { color: black }
h2.red { color: rgb(255,0,0) }
.red { color: #FF0000 }

Next up, background-color! With background-color, you can set the background area of tables (even individual cells), behind text and behind links (this will be covered in the review lesson). All of the same values that you used for color you can use for background-color.

p { background-color: black }
h2.red { background-color: rgb(255,0,0) }
.red { background-color: #FF0000 }

Similar to background-color is background-image. You can use background-image on all the same objects as background-color, you only have to change the value. Take a look:

body { background-image: url(images/background.gif) }
.image { background-image: url(images/background.gif) }

"background.gif" is an actual image, you can use it to test your style sheet skills in the below practice area. Try it out!

Practice

You now have covered all the basic style sheet techniques, so let's Review (with link effects)!

Introduction | Fonts | Color/Backgrounds | Review and Link Effects


Featured Web Site
New Wave Aquaria
New Wave Aquaria

Internet Factoids
Only 3.8% of internet surfers use a Macintosh operating system. (September 2006)

Source