HTML Colors
HTML Tutorial » HTML Colors
CSS Color Values
With CSS, colors can be specified in different ways as:
1. RGB values
2. color names
3. hexadecimal values
4. HSL values (CSS3)
We can add Colors in different ways as:
Inline - by using the style attribute in HTML elements
Internal - by using a <style> element in the <head> section
External - by using an external CSS file as style.css
Syntax - Inline:
<tagname style="color:value">your text </tagname>
Note: use external CSS instead
Colors can be set by using color names - examples
Color Names:
With CSS, colors can be set by using color names:
Color | Name |
---|---|
Wite | |
Gray | |
Red | |
Yellow | |
Green | |
Brown | |
Cyan | |
Blue | |
Magenta | |
Black |
Example:
Example 1, colors can be set by using color name - example
<!DOCTYPE html>
<html>
<head>
<title>HTML colors can be set by using color name - example</title>
</head>
<body>
<h1>HTML colors can be set by using color name - example</h1>
<span style="color:red">Your text here</span>
<p style="color:yellow; background-color:blue">Text here -
With CSS, colors can be set by using color names - example</p>
</body>
</html>
Note: Use internal or external CSS instead.
HTML RGB Colors - examples
RGB color values are supported in all browsers.
RGB color system, constructs all the colors from the combination of the Red, Green and Blue colors.An RGB color value is specified with: rgb( RED , GREEN , BLUE ).
Each parameter defines the intensity of the color as an integer between 0 and 255.
Color | RGB |
---|---|
rgb(255,0,0) | |
rgb(0,255,0) | |
rgb(0,0,255) |
Example:
HTML RGB Colors - examples:
<!DOCTYPE html>
<html>
<head>
<title>HTML RGB Colors - example</title>
</head>
<body>
<h1>HTML RGB Colors - example</h1>
<span style="color:rgb(255,0,0)">Your text here</span>
<p style="color:rgb(0,255,0); background-color:rgb(0,0,255)">Text here -
With CSS, colors can be set by using color names - example</p>
</body>
</html>
HTML Hexadecimal Colors - examples
Hexadecimal numbers are used on web pages to set colors.
The color is defined by its mix of Red, Green and Blue, each of which can be in the range:
A hexadecimal color is specified with: #RRGGBB.
Color | HEX | RGB | Color |
---|---|---|---|
#FF0000 | rgb(255,0,0) | Red | |
#00FF00 | rgb(0,255,0) | Green | |
#0000FF | rgb(0,0,255) | Blue |
Example:
HTML Hexadecimal Color - examples:
<!DOCTYPE html>
<html>
<head>
<title>HTML Hexadecimal Colors - examples - example</title>
</head>
<body>
<h1>HTML Hexadecimal Colors - examples - example</h1>
<span style="color:#FF0000">Your text here</span>
<p style="color:#00FF00; background-color:#0000FF">Text here -
With CSS, colors can be set by using color names - example</p>
</body>
</html>
HTML Colors names, codes, picker, background, palette, hex, green, color
HTML Colors - html tutorial
Online Editor
This tool makes it easy to create, adjust, and experiment with custom colors for the web.
HTML Templates

Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.
CSS HTML Layout

Find here examples of creative and unique website layouts.
Free CSS HTML Menu

Find here examples of creative and unique website CSS HTML menu.