Web Design

Web Design - Articles & Information To Help You With Web Design

Hexadecimal Color Notation On The Web


Web Design

When designing elements for your webpage, you will often be called upon to specify a color. For example, the code for a span shown below specifies that the color of the text within the span will be yellow.

Text

Colors can be specified according to their names, for example "yellow", "green", or "blue". In many cases, these simple color names will work. But what if you want to specify a more sophisticated color like "cornflowerblue"? A particular browser may not recognize a particular color name. It's more reliable to specify colors with an "RGB triplet".

An RGB triplet specifies a color based upon the amounts of red, green, and blue, on a scale from 0 to 255, required to create the color. For example, to create the color cornflowerblue you need red=100, green=149, and blue=237. We could then specify the color of the text within a span using the rgb function as shown below.

Text

This will work fine with style notation, but what if you want to use straight html. Html doesn't recognize the rgb function. In that case, you can specify color using "hexadecimal" notation. Whereas the decimal numbering system uses the characters 0 through 9 to get 10 values, the hexadecimal numbering system uses the characters 0 through f to get 16 values. (After 9 the characters a, b, c, d, e and f are used, as shown below.)

Decimal Hexidecimal Equivilants

dec hex

0 = 0

1 = 1

2 = 2

3 = 3

4 = 4

5 = 5

6 = 6

7 = 7

8 = 8

9 = 9

10 = A

11 = B

12 = C

13 = D

14 = E

15 = F

On first appearance, this looks pretty simple but you need two hexadecimal characters to represent all decimal values from 0 to 255. When you increment decimal 9 by 1, you change the 9 to 0 and put 1 in the ten's place. When you increment hexidecimal F by one, you change the F to 0 and put 1 in the "sixteens" place. Sometimes it's not easy to convert between decimal and hexadecimal in your head.

RGB Triplet for Cornflowerblue

color dec hex

red 100 64

green 149 95

blue 237 ED

We could then specify the color of text within a span using the hexadecimal notation as shown below.

Text

Note that when we indicate the use of hexadecimal notation by placing a pound (#) sign in front of the number, and we don't use commas to separate the color components.

If it's not easy to convert between decimal and hexadecimal in your head, then how do you do it? You can use a calculator that has a decimal to hexadecimal coversion function, or you can learn to think in hexadecimal. For example, what's the next number after CE? That would be CF. what's the next number after CF? That would be D0. Which hexadecimal number is higher 99 or B2? B2 would be higher than 99. It gets easier with experience.

Here's Java Script code for a simple decimal to hexidecimal color converter

function convert(decvalue)

{

var num = parseInt(decvalue);

if(num >= 0 && num < 256)

{

var hexnum = num.toString(16);

alert("#" + hexnum);

}

else {alert("Error!");}

}

It's important to use hexadecimal notation to specify colors when you use DHTML with visual effects, because to create a dynamic color change you have to increment or add a value to a color. The vast amount of color specification on webpages is in hexadecimal notation, so it would be wise to become familiar with it.

Copyright(C) Bucaro TecHelp.

Permission is granted for the below article to forward, reprint, distribute, use for ezine, newsletter, website, offer as free bonus or part of a product for sale as long as no changes are made and the byline, copyright, and the resource box below is included.

About The Author

To learn how to maintain your computer and use it more effectively to design a Web site and make money on the Web visit bucarotechelp.com. To subscribe to Bucaro TecHelp Newsletter visit http://bucarotechelp.com/search/000800.asp







Created & Maintained by Empower! CMS Web Sites

Host2Sell Web Hosting   |   Emarketing Workshops   |   Site SEO Review   |   FREE Newsletter

South Africa's Top Sites




| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |











How To Use Emotional Content To Increase Visitor Response
Did you know that many folks make "buying decisions" when they are moved emotionally? Other traditional medias have made the most of these principles and taken advantage of them for many years, whether it be a TV commercial or an ad in a magazine. People are emotional beings and people make decisions (either good or bad) when they are emotional. If something causes a customer to become upset, they become angry and try and solve it. If they become upset enough...they'll make a decision to perhaps discontinue your service and hire another service. On a positive side, the TV media bombards us with commercials that try to make an advertisers product seem fun or cute. The...(related: Web Design)


Understanding How Html Color Codes Work
Ever wonder how HTML color codes are put together? For the beginner, it can look like lots of numbers and letters that make no sense. In reality, HTML color codes are written that way for a specific reason that we'll look at in this article.Introduction to the Hexadecimal SystemIn mathematics,...(related: Web Design)


Why Do Images Disappear From A Webpage?
In learning webpage design, I encountered many problems that took lots of practice to resolve. Although, I was building web pages using Microsoft Frontpage on my home computer, I used to face lots of issues after uploading the webpage to my website.One major problem was the disappearance of an image file from the webpage. When I created the webpage on ...(related: Web Design)


Website Design: Secrets Of Professional Website Designers Revealed
What colors do you have at your website?Can they make a difference in the number of sales that yougenerate?Can the use of the right colors in your website design actually increase your sales?The answer is yes!So pay attention to thesee website design secrets.When people see certain colors they can change their emotions or they can symbolize things related to the colors.Here are a list of colors with some emotions and symbolizations they can cause:Red - love, excitement, warmthPink - romantic, affection, sensualityWhite - purity, peace, perfectionBlue - sky, water, travel, freedom, truth...(related: Web Design)


Should I Use Pop-up Ads?
Web advertising has taken many forms, including those that appear within the Web page as an in-line graphic, as well as those that "pop up" (over) or "pop under" a browsing window. If you are considering the use of pop ups on your website as an advertising method, this article provides some points you should consider....(related: Web Design)


Web Site Templates And Their Benefits
Unarguably, the most important part of your website is content. To draw in clients or customers, you need captivating content and search engines are blind to web design. They only see content. The images, structure and colors of your website go out the window when it comes to search engine placement, which we all know is the single best traffic generator. Your web design is really only a shell that makes your content look pretty. Don't get me wrong, your site's design can be very important. People are influenced by colors they see, and the quality of your design lends credibil...(related: Web Design)




Google




Web Usability: The Basics
What is web usability & why is it important?Web usability is about making your website in such a way that your site users can find what they're looking for quickly and efficiently. A usable website can reap huge benefits on to your website and your business.* Every £1 invested in improving your website's usability returns £10 to £100 (source: IBM)* A web usability redesign can increase the sales/conversion rate by 100% (source: Jakob Nielson)Your ...(related: Web Design)

How A Custom Designed Website Can Help Your Business
Over the years, the internet has grown into a marvelous avenue to promote your business.In my last article, "Why Your Business Needs to Have an Internet Presence" (http://www.jvmediadesign.com/info37.html), I discussed 5 valid reasons why your business needs a website. In this article, I discuss some things to avoid and how a custom, professional website can help your business succeed.Professional is the key. Remember, the internet has a global reach. Some of your new potential clientele may be learning of your business for the first time by visiting your website and the old cliché, "you never get a second chance to make a first impression", still rings true.When a business makes the decision to gain an internet presence, whether they are the largest...(related: Web Design)

Does Your Homepage Work?
All websites have a homepage. It is the most important page of your site. It acts as the main gateway to the entire site. Most of your prospective customers will enter through it. Its vital to get it right. You dont want them to j...(related: Web Design)

site-map - Copyright © 2006 Empower! Web Design | All Rights Reserved. | Web Design