Hexadecimal Color Notation on the Web

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

In The News:

This RSS feed URL is deprecated, please update. New URLs can be found in the footers at https://news.google.com/news

Clutch Names Designzillas Top Web Design Company in Orlando
PR Newswire (press release)
ORLANDO, Fla., April 20, 2018 /PRNewswire/ -- Clutch Names Designzillas Top Web Design Company in Orlando. Designzillas--an Orlando-based digital creative...

and more »

Responsive Design of DC Plan Web Portals Greatly Benefits ...
Planadviser.com
A new analysis from Corporate Insight underscores the continued proliferation of “responsive design” within retirement plan service providers' web offerings—benefiting plan participants and sponsors.

and more »

Neowin

Pay What You Want for this Learn to Web Design bundle, includes Photoshop courses
Neowin
Today's highlighted offer comes via our Online Courses section of the Neowin Deals store, where for only a limited time you can Pay What You Want for the Learn to Web Design Bundle. Break into the lucrative world of professional web design with up to ...


Clutch Names Designzillas Top Web Design Company in Orlando
Markets Insider
ORLANDO, Fla., April 20, 2018 /PRNewswire/ -- Clutch has named Designzillas the top web design company in the Orlando market. Clutch published their newest report on leading design companies which features a Leaders Matrix based on services offered ...


What is Functionality in webdesign and features to implement it?
SitePoint
virendarsehwag319 2018-04-21 11:23:20 UTC #1. Based on a persona that I have, I need to say which website functionality of a mobile purchase website would be important for that user. But I want to know: 1) What is functionality in web design? Examples ...


Prague Post

3 Features To Consider About Your Web Design
Prague Post
Creating a good business website can sound very difficult, though it does not have to be challenging. If you need to design a website for your business, start by identifying what it is that you desire your web design to achieve. Thus, you will need to ...


BGR

The iconic Gmail web design is getting a complete overhaul
BGR
The winds of change are a-blowin in Gmail's direction. According to Engadget, Google sent out an email to G Suite Administrators, the people who manage and control corporate or group email accounts running on Google's webmail platform. The email is a ...
Gmail is getting a new look — take a peekBusiness Insider
This is the new Gmail designThe Verge
New Gmail for web design shown in leaked imagesPhoneDog
Pixel Spot (blog) -TechCrunch -TechCrunch
all 746 news articles »

Asbury Park Press

PHOTOS: Web Design Pathway Program at Freehold High School
Asbury Park Press
Lori Purswani, 15, of Freehold Boro, talks about the travel website she created with her teacher, Rhonda Solomon, during her Honors Web Design class, which is part of the Web Design Pathway Program, at Freehold High School in Freehold, NJ Friday April ...


Business MattersBusiness Matters

Why you should hire a professional web design agency
Business MattersBusiness Matters
Designing a mobile-friendly and responsive website is no easy process and this is only made more difficult by the fact that the digital world is ever-changing. It is only those who are skilled in software applications and existing web standards that ...

and more »

The Sun Chronicle

You're never too young for creative web design
The Sun Chronicle
When it comes to designing websites and video games, you're never too young. Cameron Bergamo, 9, a third-grader at Norton's L.G. Nourse Elementary School, was among youngsters attending a Saturday web design course recently at Foxboro's Invensys branch ...

and more »
Google News

How to Avoid the Biggest Mistakes Member Sites Make in Their Marketing Copy

If you have a web site to which people pay... Read More

Creating the Perfect Website - A beginners Guide

Are you looking to create the perfect website? A complete... Read More

Flash Web Design - The Wave of the Future?

There are two camps when it comes to flash web... Read More

3 Simple Ways To Dramatically Improve Your Website

Before you start worrying about marketing your website on the... Read More

So Much About META Tags!

I've written about META tags in the past, and I... Read More

Simplify Your Web Site for Clarity and Ease of Use

There are plenty of web sites out there in which... Read More

The Monster Garage of eLearning

Have you seen Jesse James on the... Read More

Positive Design Attributes for a Successful Website

Designing a website is hard job, and requires you to... Read More

10 Reasons Why You Need A Multilingual Website

The internet continues to grow and has become the default... Read More

What Is Your Websites Most Wanted Response?

You spend time and money promoting your website; but what... Read More

The Best Simple Software For The Busy Webmaster

Here are a few programs I can't do without. They're... Read More

The Top 8 Website Sins Part One

They say the eyes are the window to the soul.... Read More

Marketing Basics for the Webmaster

What is the relationship between Marketing and Web designing? How... Read More

Website Advertising: 10 Dynamic Tactics To Super-Charge Your Sales

Here are 10 dynamic website advertising tactics to super-charge your... Read More

TEN Answers That Turn Your Visitors Into Your Customers

You know... Before purchasing your product a person comes to... Read More

Ten Steps to a Winning Home Page

There's no doubt about it - the first page your... Read More

Hiring The Right Webmaster

The Questions You Should Be Asking ? The Answers You... Read More

How a Custom Designed Website Can Help Your Business

Over the years, the internet has grown into a marvelous... Read More

Is Your Site Too Slow? Why Image Optimization Is Critical

Graphics are fun, but if you put in too many... Read More

Get Rid of Your Frames

A few years ago a lot of websites utilized frame... Read More

How to Prepare Your Project Before You Order Website Design

Are you serious about get this website done fast and... Read More

Build Web Pages from the Top Left Corner Down

There are two important reasons to build your website from... Read More

Browser Compatibility

Internet Explorer, created by microsoft has been the most popular... Read More

Why Dot-Coms Fail - a Webmasters Perspective

Everyday we hear that another company goes out of business.When... Read More

Drupal Modules

There are plenty of Drupal Modules that you can install... Read More