Color Names Allowed In HTML/CSS - Stack Overflow

    1. Home
    2. Questions
    3. Tags
    4. Users
    5. Companies
    6. Labs
    7. Jobs
    8. Discussions
    9. Collectives
    10. Communities for your favorite technologies. Explore all Collectives

  1. Teams

    Ask questions, find answers and collaborate at work with Stack Overflow for Teams.

    Try Teams for free Explore Teams
  2. Teams
  3. Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Get early access and see previews of new features.

Learn more about Labs Color names allowed in HTML/CSS Ask Question Asked 15 years, 2 months ago Modified 8 years, 11 months ago Viewed 5k times 3

I know and use a few color names like 'white', 'blue', 'red', is there a complete list of colors allowed in HTML/CSS ?

Share Improve this question Follow edited Jun 4, 2012 at 13:26 Manishearth's user avatar Manishearth 16.1k8 gold badges60 silver badges76 bronze badges asked Oct 12, 2009 at 5:00 eozzy's user avatar eozzyeozzy 68.5k108 gold badges284 silver badges446 bronze badges 4
  • 2 erm, lmgtfy.com/?q=css+colors&l=1 – Peter Commented Oct 12, 2009 at 5:03
  • 1 @nimbuz, why did you accept a wrong answer? that doesn't make the quality of SO better, if you just accept whatever answer. – markus Commented Oct 12, 2009 at 5:10
  • All answers are more or less similar. – eozzy Commented Oct 12, 2009 at 5:14
  • my answer says essentially the same thing as the one that is selected as the answer and was up a few minutes before the one selected as answer.... not only that but someone voted it down. :/ – sohum Commented Oct 12, 2009 at 14:23
Add a comment |

5 Answers 5

Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 8

CSS3-color has the complete 'Extended color keywords' list.

Share Improve this answer Follow edited Jan 28, 2015 at 4:58 dayuloli's user avatar dayuloli 17k18 gold badges74 silver badges132 bronze badges answered Oct 12, 2009 at 15:48 Ms2ger's user avatar Ms2gerMs2ger 16k6 gold badges40 silver badges36 bronze badges 0 Add a comment | 3

There are a plethora of colors listed at http://www.w3schools.com/HTML/html_colornames.asp. There's also a cautionary note at the bottom:

Note: The names above are not a part of the W3C web standard.

The W3C HTML and CSS standards have listed only 16 valid color names: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow.

If you want valid HTML or CSS use the HEX values instead.

Share Improve this answer Follow answered Oct 12, 2009 at 5:02 John Kugelman's user avatar John KugelmanJohn Kugelman 361k69 gold badges546 silver badges591 bronze badges 1
  • 1 This is no longer entirely true: HTML4 only lists 16 colors, but CSS3 lists a total of 147 valid color names—the same ones in SVG (which are mostly based on X11). Longer answer in a bit since I can’t deal with the return key in comments. – Eric A. Meyer Commented Jun 4, 2012 at 13:41
Add a comment | 2

The CSS Color Module Level 3, which is a full W3C Recommendation and therefore supersedes CSS2 where they conflict, lists the 16 HTML4 keywords as “Basic color keywords” and the 147 SVG keywords as “Extended color keywords”—the latter set of 147 being a superset of the basic 16, since they’re all included.

So the answer to your question is 147 names long, not 16; W3Schools, not surprisingly, has it wrong. There are also WAY more keywords actually recognized by browsers, but they’re not “allowed” in a legalistic sense even if they are in a practical sense. As a result, there might be slight differences between browsers when handling those keywords, since they haven’t been precisely defined in a specification.

(P.S. If you’re interested in a sortable table of all 147 extended keywords and their various numeric equivalents, I recently published one on my site along with some visualizations of the basic and extended keywords sets: color wheel and distribution chart.)

(P.P.S. The CSS3 Colors module was not a full Recommendation in 2009.)

Share Improve this answer Follow edited Jan 27, 2016 at 23:08 Zach Saucier's user avatar Zach Saucier 25.9k12 gold badges95 silver badges159 bronze badges answered Jun 4, 2012 at 13:49 Eric A. Meyer's user avatar Eric A. MeyerEric A. Meyer 9306 silver badges22 bronze badges Add a comment | 1

The W3C HTML and CSS standards have listed only 16 valid color names: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow.

From this site:

http://www.w3schools.com/css/css_colornames.asp

Share Improve this answer Follow answered Oct 12, 2009 at 5:02 sohum's user avatar sohumsohum 3,2272 gold badges41 silver badges63 bronze badges 3
  • Umm.... why did this get voted down? My response was up before the one selected as the answer. – sohum Commented Oct 12, 2009 at 14:22
  • Probably because you referenced w3schools.com, which is horribly out of date and often incorrect. – GregL Commented May 15, 2014 at 7:16
  • Which was the same website referenced by the answer..... so what is your point exactly? – sohum Commented May 15, 2014 at 18:02
Add a comment | 0

There are actually 17 "standard" colors, according to W3 spec: http://www.w3.org/TR/CSS2/syndata.html#color-units

In addition, there are some built-in names for system colors: http://www.w3.org/TR/CSS2/ui.html#system-colors

This 2nd set is deprecated in CSS3.

Share Improve this answer Follow answered Aug 11, 2011 at 17:21 chris's user avatar chrischris 37.4k54 gold badges160 silver badges244 bronze badges Add a comment |

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid …

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

Draft saved Draft discarded

Sign up or log in

Sign up using Google Sign up using Email and Password Submit

Post as a guest

Name Email

Required, but never shown

Post Your Answer Discard

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.

  • The Overflow Blog
  • Why do developers love clean code but hate writing documentation?
  • This developer tool is 40 years old: can it be improved?
  • Featured on Meta
  • The December 2024 Community Asks Sprint has been moved to March 2025 (and...
  • Stack Overflow Jobs is expanding to more countries
11 It is recommendable to type the color's name instead of its hex value in CSS? 80 Are there any cons to using color names in place of color codes in CSS? 0 CSS Colours not displaying 0 List color is not coming in CSS 2 CSS in HTML colour 0 What is the basis of named colors on the web? 0 add color to list in html 1 Is defining colours by name safe nowdays? 1 Text colouring in CSS within lists 0 Is it possible using CSS to define a prescribed list of colour values that can be used in a class?

Hot Network Questions

  • Permanent night on a portion of a planet
  • Why did Gru have to adopt the girls?
  • Adapting Accent to Seem More Professional
  • Is ‘drop by’ formal language?
  • Why is Jesus called Prince of Peace and not King of Peace considering he was also called Eternal Father?
  • Makefile for a tiny C++ project
  • Misunderstanding a code
  • Ways to keep files in /tmp?
  • Why don't the Bene Gesserit retaliate against Vladimir Harkonnen for trying to kill Jessica and Paul?
  • ping from script launched by cron
  • Does the wave function of a group of particles collapse upon a collective measurement?
  • How to repair a broken ground wire?
  • Why does ctldl.windowsupdate.com not use (valid) TLS?
  • Object recognition and barcode scanning with the same camera
  • Is 骰子 pronounced "shăi zi" or "tóu zi"?
  • Systemd service to start only after CIFS mount
  • Why is there no AES-512 for CTR & variants to have good large nonces?
  • How is it conceptually possible to have fault-tolerant quantum computing with constant overhead
  • scp with sshpass does not work (with custom identity file and custom port)
  • Do experimental projects harm my theoretical profile?
  • Merits of `cd && pwd` versus `dirname`
  • Answering student's question that is already in the upcoming exam
  • Captions not centered with the standalone class and varwidth option + caption package
  • Is it impossible to physically observe whether an action is voluntary (purposeful)?
more hot questions Question feed Subscribe to RSS Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-html

Từ khóa » Html Color Names W3schools