List of colors accepted in HTML and CSS

There are some color names that I am familiar with and use, such as 'white', 'blue', 'red'. Is there a comprehensive list of colors that can be used in HTML/CSS?

Answer №1

CSS3-color provides a comprehensive compilation of the 'Extended color keywords'.

Answer №2

For a wide array of colors, you can check out the extensive list at http://www.w3schools.com/HTML/html_colornames.asp. However, it's important to be aware of a warning provided at the end:

Please note: The color names mentioned above are not officially recognized as part of the W3C web standard.

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

To adhere to valid HTML or CSS guidelines, it is recommended to use HEX values instead.

Answer №3

In the realm of CSS, the Color Module Level 3 stands as a comprehensive W3C Recommendation that takes precedence over CSS2 in case of conflicts. It identifies the 16 standard HTML4 color keywords as "Basic color keywords" and the additional 147 SVG color keywords as "Extended color keywords," with the latter encompassing the former within its list.

Contrary to what W3Schools suggests, the answer to your query actually consists of 147 names rather than 16. Moreover, browsers recognize a plethora of other keywords beyond these standardized lists; however, they may not be officially sanctioned even if they are practically functional. Consequently, some slight variations might occur across browsers while interpreting these unofficial keywords due to the lack of precise specification.

(P.S. For those intrigued by a sortable table featuring all 147 extended keywords alongside their corresponding numeric representations, I have recently shared one on my website. Additionally, visualizations for both the basic and extended keyword sets can be found in the form of a color wheel and a distribution chart.)

(P.P.S. Please note that back in 2009, the CSS3 Colors module had not yet attained full Recommendation status.)

Answer №4

According to W3C standards, there are only 16 valid color names in HTML and CSS, including aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow.

This information can be found on the following website:

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

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the correct way to scroll to a specific div using jQuery?

Here is the button code I have: <button class="contactButton">XYZ</button> When the user clicks on this button, I want my page to smoothly scroll down to a specific section. I attempted to achieve this with the following jQuery code ...

Replacing HTML content using PHP's str_replace function

Could someone help me troubleshoot this code snippet? $str = 'di &lt;a href="http://www.cadoinpiedi.it/author/redazione-la/#C" style="color:#006699; text-decoration:none;"&gt;VARIABLE NAME&lt;/a&gt;'. '&l ...

Challenges Arising from CGI Scripts

One requirement for the user is to input text into a designated text field within a form element in my HTML. Following this, a CGI script processes the user's input and JavaScript code is responsible for displaying the processed information. JavaScri ...

Tips for showcasing two cards side by side on mobile screens?

This is my glitch. I have a layout where I see 3 cards in a row for desktops, 2 cards per row on tablets, and 1 card for mobile devices. However, I would like the cards to resize and display 2 cards in a row on mobile. How can I achieve this? Here is the f ...

Use jQuery or JavaScript to incorporate HTML elements into your webpage

I have created an agenda system with weeks, but I am looking for an option that allows the user to add unlimited weeks. HTML <h1>Agenda</h1> <div class="balkje dicht"> <h2>WEEK 1</h2> <div> <div class="col1 ...

How to integrate video into HTML code using JSON wrapping in iOS app development for iPhone IOS4

I am currently developing an HTML-based application with a JSON wrapper. Ever since the recent 4.0.2 update, the video playback on iPhones has been experiencing some issues. Despite having all the necessary code in HTML to play the video files, post-update ...

Tips for adjusting the offset dimensions in Bootstrap 4 grid systems

Incorporating Bootstrap 4 into my Angular 8 application, I am faced with an issue on the main page where I have two components sized md-5 and md-6, respectively. To create a gap between them, I used offset-md-1. However, the offset size is too large, res ...

Looking for a solution to fix the VueJS calculator that only works once?

My calculator project using VueJS, HTML and CSS is almost complete. However, I'm facing an issue where it only works once. For example, if I input 6x3, it correctly gives me 18. But if I then clear the result and try to input a new calculation like 3 ...

Tips on setting the default sorting order in AngularJS

I have implemented a custom order function in my controller with the following code: $scope.customOrder = function (item) { var empStatus = item.empState; switch (empStatus) { case 'Working': return 1; case & ...

The lists Ul and Ol are currently not displaying numbers or circles

Hi there, I'm encountering an issue with the ol and ul tags not displaying numbers and circles on the left side. I am not using a reset css file. Below is my code snippet: <ol> <li>ALL FILES</li> <li>PHP SCRIPTS</li ...

Using jQuery to smoothly transition the page: first fade out the current content, then switch the background

I'm currently facing an issue with trying to create a step-by-step operation that involves fading the container div around a target div, changing the background, and then fading it back in. The problem is that all the functions in this block are being ...

The HTML5 postMessage function often returns an undefined value

My attempt to establish cross-domain communication using postMessage between a page hosted on example1.com and an iframe within the same page on example2.com is facing some challenges. Once the iframe finishes loading, it sends a postMessage to the parent ...

What could be causing my span element to not show up on my header?

How can I add (mock) buttons to my page using just CSS? I've been trying to display a span element but it's not showing up. I've experimented with setting its display to block and positioning it absolutely, but so far nothing has worked. Whi ...

The div placed below a dropdown div when viewed on mobile

I’ve been developing a responsive website that works seamlessly on both mobile and desktop. After some tweaking, I managed to get the navigation menu to display just the way I wanted in desktop mode with no dropdowns. However, an issue arises when switch ...

Placing an image centrally between the header and footer using CSS

My goal is to create a straightforward landing page that includes a header, footer, and an image perfectly centered between the two (both horizontally and vertically). The space above and below the image should be equal and adjust based on the height of t ...

I am looking to display the <AddProduct /> element within the main-content div of a different component called Dashboard

import { useState,useEffect } from 'react'; import './App.css'; import Header from './Components/Header/Header'; import { BrowserRouter as Router, Route ,Routes} from 'react-router-dom'; import Pages from './Pag ...

Border appearing around a table row when it expands

I am working with a table that has multiple rows, and my goal is to make the border of a row extend over other rows when it is expanded. Refer to the image below for a visual representation. I am utilizing Bootstrap 5 and JQuery for this task. I have creat ...

Struggling to style a nested table using CSS

Please take a look at this JSFiddle example for reference. I am currently working with tablesort and its associated CSS to achieve alternating row colors for the rows containing first and last names. Additionally, I want the rows within the sub-table disp ...

Building Valid HTML Strings with Qt4.2's QTextEdit

My goal is to create HTML content to display correctly in a QTextEdit using Qt 4.2 on RHEL 5.3. Although I am not a professional web developer, I believe the HTML generated by my algorithm is valid. 319:14:27:22: <font color="rgb(255,0,0)" bgcolor="r ...

How to make a div in Javascript smoothly slide out when it appears

Looking to add some smooth sliding animation to this basic JS code instead of the glitchy appearance it currently has. I've experimented with different options but haven't had any success, any suggestions? Here's the code snippet along with ...