Featured Links

Other Topics






Quote of the Day

"A friend is one of the nicest things you can have, and one of the best things you can be."

Douglas Pagels








 




 
Featured Html Articles

50 Surefire Web Design Tips
Tips to brand your website Include your logo in all pages. Position it at the top left or each page. Complement your logo with a tagline or catchy sentence that summarizes your business purpose. For example "Always low prices" is the tagline for ...

Build a Web Site that Works...Even for a Safari Hobby!
My life's greatest passion is a safari hobby. And what would that be, you ask. ...Simply the conservation of wildlife and the environment. I do this after hours from my 7 to 5 job. And that's how this story started. Read this story to learn how to build ...

The 3 Musts for Running Your Web Design Business Efficiently and Effectively
There is no shortage of Web sites and books on how to create graphics for Web sites and how to use HTML or programming software. However, in order to run a Web design business efficiently and effectively you need to know a whole lot more than just how to ...




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.






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






Google


Html News

Sony Cybershot with Built-In Wi-Fi, Web Browser - Wired
LAS VEGAS -- Sony has invented the webcam. Or at least, it has put the web into a cam. At CES 2009, the company debuted Cybershot DSC-G3, the first camera to have built in 802.11 (b,g) Wi-Fi along with a web browser. As a camera, it's no slouch. Ten ...

Palm Steals CES Spotlight With New Smartphone and OS - TechNewsWorld
Palm's long nightmare may be over. The PDA pioneer is rising from the ashes -- at least, investors appear to think so -- with a brand new touchscreen smartphone and a new mobile operating system to boot. Palm's share price flew from $3.36 to a lofty ...

Mexico rules out growth this year - Financial Times
Mexico said on Thursday there would be no growth this year, in a frank admission that the US recession will hit the economy far more than official estimates ­suggest. In an interview with a local radio station, Agustín Carstens, the finance ...

Steven Kent, the Wii Bubble, and Nintendo's Drinking Problem - Wired
Steven Kent, author of The Ultimate History of Video Games and one of the best-known journalists on the gaming beat during the last console generation, left journalism behind a few years back to concentrate on writing novels. So it was a lucky thing ...

Jury deliberations begin in Calif. corruption case - Forbes
Jurors have begun deliberations in the trial of a former Southern California sheriff accused of accepting tens of thousands of dollars in bribes and kickbacks in exchange for the power of his office. The deliberations began Thursday in the corruption ...

Ill. House panel recommends governor's impeachment - FOX News
SPRINGFIELD, Ill. — An Illinois House committee has unanimously recommended that Gov. Rod Blagojevich (bluh-GOY'-uh-vich) be impeached for abuse of power. The decision sets the stage for the full House to take action Friday and make Blagojevich the ...

Alzheimer's drugs double death risk in elderly - Seattle Post Intelligencer
LONDON -- Anti-psychotic drugs commonly used to treat Alzheimer's disease may double a patient's chance of dying within a few years, suggests a new study that adds to concerns already known about such medications. "For the vast majority of Alzheimer ...

Pa. man pleads guilty to seeking sex with Md. girl - Philadelphia Inquirer
BALTIMORE - Federal prosecutors say a Pennsylvania man has pleaded guilty to seeking sex with a Maryland girl minutes after he met police posing online as the girl. Thirty-four-year-old Patrick Mahan of Lincoln University, Pa. entered the plea ...

Holiday Hockey Camp - Minneapolis Star Tribune
Happy New Year! Sorry for the delay in writing. I have been very busy spending lots of time in a hockey rink of course! A day after Christmas, 55 of the top female hockey players in the U.S. gathered in Blaine , Minnesota for our annual “Holiday ...

Texas filing seeks to put off suit tied to Coleman - Minneapolis Star Tribune
ST. PAUL, Minn. - A new court filing in Texas seeks to suspend a lawsuit alleging that a friend and donor of Republican Norm Coleman tried to improperly steer money to the then-U.S. senator. The filing this week by attorneys representing Deep Marine ...