

{"id":78510,"date":"2020-06-27T09:00:41","date_gmt":"2020-06-27T03:30:41","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=78510"},"modified":"2024-07-26T13:23:02","modified_gmt":"2024-07-26T07:53:02","slug":"html-colors","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/html-colors\/","title":{"rendered":"HTML Colors and Color Codes"},"content":{"rendered":"<p>Using colors in an HTML web-page can make it aesthetic and attractive to the users. We will learn how to use HTML Colors and various HTML color codes.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Colors.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78738\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Colors.jpg\" alt=\"HTML Colors\" width=\"1200\" height=\"628\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Colors.jpg 1200w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Colors-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Colors-1024x536.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Colors-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Colors-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Colors-520x272.jpg 520w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<h2>HTML Colors<\/h2>\n<p>HTML colors can be displayed on a web-page by specifying them in the &lt;body&gt; tag. There are four ways to represent colors within an HTML document &#8211; predefined colors, rgb(), hex codes, and hsl(). A large variety of colors can be intermixed to make the webpage more attractive. Choosing the right color scheme for your website can significantly impact user experience and accessibility.<\/p>\n<p>For example,<\/p>\n<h3>1. Background-color in HTML<\/h3>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en-US\"&gt;\r\n&lt;head&gt;\r\n&lt;\/head&gt;\r\n &lt;body style=\"background-color: yellow;\"&gt;\r\n&lt;p&gt;Welcome to DataFlair&lt;\/p&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-15.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78748\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-15.png\" alt=\"html color tag\" width=\"250\" height=\"69\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-15.png 250w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-15-150x41.png 150w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<h3>2. Text-color in HTML<\/h3>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en-US\"&gt;\r\n&lt;head&gt;\r\n&lt;\/head&gt;\r\n &lt;body style=\"color: red;\"&gt;\r\n&lt;p&gt;Welcome to DataFlair&lt;\/p&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-1-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78740\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-1-4.png\" alt=\"HTML text color\" width=\"333\" height=\"72\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-1-4.png 333w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-1-4-300x65.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-1-4-150x32.png 150w\" sizes=\"auto, (max-width: 333px) 100vw, 333px\" \/><\/a><\/p>\n<h3>3. Links in HTML<\/h3>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"en-US\"&gt;\r\n&lt;head&gt;\r\n&lt;style&gt;\r\na:link{\r\n   color:red;\r\n}\r\na:visited{\r\n   color: purple;\r\n}\r\na:hover{\r\n   color:pink;\r\n}\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;\r\n &lt;body&gt;\r\n&lt;a href=\"headings.html\"&gt;Link&lt;\/a&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>Output Before-<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-2-5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78739\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-2-5.png\" alt=\"html link\" width=\"184\" height=\"65\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-2-5.png 184w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-2-5-150x53.png 150w\" sizes=\"auto, (max-width: 184px) 100vw, 184px\" \/><\/a><\/p>\n<p><strong>Now Hover-<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/20200615_142253-rotated.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78743\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/20200615_142253-rotated.jpg\" alt=\"html link tag\" width=\"782\" height=\"613\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/20200615_142253-rotated.jpg 782w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/20200615_142253-300x235.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/20200615_142253-150x118.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/20200615_142253-768x602.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/20200615_142253-520x408.jpg 520w\" sizes=\"auto, (max-width: 782px) 100vw, 782px\" \/><\/a><\/p>\n<p><strong>Visited-<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-3-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78742\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-3-3.png\" alt=\"html link\" width=\"201\" height=\"61\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-3-3.png 201w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-3-3-150x46.png 150w\" sizes=\"auto, (max-width: 201px) 100vw, 201px\" \/><\/a><\/p>\n<h3>4. Border-color in HTML<\/h3>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n  &lt;title&gt;DataFlair&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;h1 style=\"border:2px solid Tomato;\"&gt;DataFlair&lt;\/h1&gt;\r\n&lt;h1 style=\"border:2px solid DodgerBlue;\"&gt;DataFlair&lt;\/h1&gt;\r\n&lt;h1 style=\"border:2px solid Violet;\"&gt;DataFlair&lt;\/h1&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-4-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78741\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-4-3.png\" alt=\"html color codes\" width=\"1292\" height=\"256\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-4-3.png 1292w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-4-3-300x59.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-4-3-1024x203.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-4-3-150x30.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-4-3-768x152.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-4-3-520x103.png 520w\" sizes=\"auto, (max-width: 1292px) 100vw, 1292px\" \/><\/a><\/p>\n<p><strong>HTML Colors can be represented in the following ways-<\/strong><\/p>\n<h3>1. Using predefined colors in HTML<\/h3>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;\r\n           &lt;html lang=\"en-US\"&gt;\r\n&lt;head&gt;\r\n&lt;\/head&gt;\r\n &lt;body style=\"background-color: yellow;\"&gt;\r\n&lt;p&gt;Welcome to DataFlair&lt;\/p&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-8-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78747\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-8-1.png\" alt=\"html background color\" width=\"250\" height=\"69\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-8-1.png 250w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-8-1-150x41.png 150w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<h3>2. RGB and RGBA Colors in HTML<\/h3>\n<p>RGB specifies red, green, and blue colors. These values can range from 0 to 255 based on the intensity. This means that there is a total of 16777216 colors(256*256*256).<br \/>\nSome common colors-<\/p>\n<ul>\n<li>rgb(0,0,0)-Black<\/li>\n<li>rgb(255,255,255)-White<\/li>\n<li>rgb(255,0,0)-Red<\/li>\n<li>rgb(0,255,0)-Green<\/li>\n<li>rgb(0,0,255)-Blue<\/li>\n<li>Shades of gray- rgb(60,60,60), rgb(120,120,120),rgb(180,180,180),rgb(240,240,240).<\/li>\n<\/ul>\n<p>These values can be mixed as per your preferences.<br \/>\nIn RGBA, A defines Alpha, i.e., opacity.<br \/>\nAlpha lies between 0.0(fully transparent) and 1.0(not transparent,opaque).<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;  \r\n&lt;html&gt;  \r\n&lt;head&gt;  \r\n&lt;title&gt;DataFlair&lt;\/title&gt;\r\n&lt;\/head&gt;  \r\n&lt;body style=\"background-color: rgb(255,99,71\"&gt;\r\n&lt;h1 style=\"text-align: center;\"&gt;&lt;u&gt;&lt;i&gt; Welcome to DataFlair&lt;\/i&gt;&lt;\/u&gt;&lt;\/h1&gt; \r\n&lt;h2 style=\"text-align: center;\"&gt;&lt;u&gt;About Us&lt;\/u&gt;&lt;\/h2&gt; \r\n&lt;p align=\"center\" style=\"color: rgba(255,255,255,0.8);\"&gt;\r\nWe continuously work hard to bring you the best trainers to enable your smooth learning at your home as per your convenience. This is the reason why most of the DataFlair students get placed in top MNCs in Big Data just after the training.\r\nDataFlair team comprises of trainers who are experts in their relevant technologies and are selected after many rounds of interviews, content team that continuously works hard to provide quality content to the readers, Marketing team that work hand in hand with other teams to make the content reaches the right audience and HR team that work to extend the team and to provide a healthy work environment.\r\n&lt;\/p&gt;\r\n&lt;\/body&gt;  \r\n&lt;\/html&gt;<\/pre>\n<p><b>Output:<\/b><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-5-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78744\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-5-1.png\" alt=\"\" width=\"1287\" height=\"336\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-5-1.png 1287w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-5-1-300x78.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-5-1-1024x267.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-5-1-150x39.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-5-1-768x201.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-5-1-520x136.png 520w\" sizes=\"auto, (max-width: 1287px) 100vw, 1287px\" \/><\/a><\/p>\n<h3>3. Hex Colors in HTML<\/h3>\n<p>Hex colors are specified in #RRGGBB where RR is red, GG is green, and BB is blue. These values are in hexadecimal integers.They also range from 0 to 255.<\/p>\n<p>Common colors-<\/p>\n<ul>\n<li>Red-#ff0000<\/li>\n<li>Green-#00ff00<\/li>\n<li>Blue-#0000ff<\/li>\n<li>Black-#000000<\/li>\n<li>White-#ffffff<\/li>\n<li>Shades of Gray- #3c3c3c,#b4b4b4,#787878<\/li>\n<\/ul>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;  \r\n&lt;html&gt;  \r\n&lt;head&gt;  \r\n&lt;title&gt;DataFlair&lt;\/title&gt;\r\n&lt;\/head&gt;  \r\n&lt;body style=\"background-color:#3cb371\"&gt;\r\n&lt;h1 style=\"text-align: center;\"&gt;&lt;u&gt;&lt;i&gt; Welcome to DataFlair&lt;\/i&gt;&lt;\/u&gt;&lt;\/h1&gt; \r\n&lt;h2 style=\"text-align: center;\"&gt;&lt;u&gt;About Us&lt;\/u&gt;&lt;\/h2&gt; \r\n&lt;p align=\"center\" style=\"color:#ffffff;\"&gt;\r\nWe continuously work hard to bring you the best trainers to enable your smooth learning at your home as per your convenience. This is the reason why most of the DataFlair students get placed in top MNCs in Big Data just after the training.\r\nDataFlair team comprises of trainers who are experts in their relevant technologies and are selected after many rounds of interviews, content team that continuously works hard to provide quality content to the readers, Marketing team that work hand in hand with other teams to make the content reaches the right audience and HR team that work to extend the team and to provide a healthy work environment.\r\n&lt;\/p&gt;\r\n&lt;\/body&gt;  \r\n&lt;\/html&gt;\r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-6-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78745\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-6-1.png\" alt=\"\" width=\"1287\" height=\"308\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-6-1.png 1287w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-6-1-300x72.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-6-1-1024x245.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-6-1-150x36.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-6-1-768x184.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-6-1-520x124.png 520w\" sizes=\"auto, (max-width: 1287px) 100vw, 1287px\" \/><\/a><\/p>\n<h3>4. HSL and HSLA colors in HTML<\/h3>\n<p>HSL represents hues, saturation, and lightness. HSLA has an additional Alpha, which represents opacity.<br \/>\nHue ranges from 0 to 360 and is the degree of color\u2019s intensity.<\/p>\n<p>For example,<br \/>\n0 is red,120 is green, 240 is blue.<\/p>\n<ul>\n<li><strong>Saturation<\/strong> represents the shade of a particular color. For example,<br \/>\n0% is the shade of gray, and 100% is the entire color.<\/li>\n<li><strong>Lightness<\/strong> represents how much light you want and is also specified in percentages. For example,<br \/>\n0% is black, 50% is in between light and dark, and 100% is white.<\/li>\n<\/ul>\n<p>Some common colors-<\/p>\n<ul>\n<li>Red-hsl(0,100%,50%)<\/li>\n<li>Blue-hsl(240,100%,50%)<\/li>\n<li>Black-hsl(0,100%,0%)<\/li>\n<li>White-hsl(0,100%,100%)<\/li>\n<li>Shades of grey- Specified by setting the hues and saturation to 0.<\/li>\n<li>hsl(0,0%,47%),hsl(0,0%,71%).<\/li>\n<\/ul>\n<p>In HSLA, A (Alpha) defines the opacity. It ranges from 0.0 to 1.0, where 0 is fully transparent, and 1.0 is opaque.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;!DOCTYPE html&gt;  \r\n&lt;html&gt;  \r\n&lt;head&gt;  \r\n&lt;title&gt;DataFlair&lt;\/title&gt;\r\n&lt;\/head&gt;  \r\n&lt;body style=\"background-color:hsl(0,100%,25%);\"&gt;\r\n&lt;h1 style=\"text-align: center;\"&gt;&lt;u&gt;&lt;i&gt; Welcome to DataFlair&lt;\/i&gt;&lt;\/u&gt;&lt;\/h1&gt; \r\n&lt;h2 style=\"text-align: center;\"&gt;&lt;u&gt;About Us&lt;\/u&gt;&lt;\/h2&gt; \r\n&lt;p align=\"center\" style=\"color:hsla(0,100%,90%);\"&gt;\r\nWe continuously work hard to bring you the best trainers to enable your smooth learning at your home as per your convenience. This is the reason why most of the DataFlair students get placed in top MNCs in Big Data just after the training.\r\nDataFlair team comprises of trainers who are experts in their relevant technologies and are selected after many rounds of interviews, content team that continuously works hard to provide quality content to the readers, Marketing team that work hand in hand with other teams to make the content reaches the right audience and HR team that work to extend the team and to provide a healthy work environment.\r\n&lt;\/p&gt;\r\n&lt;\/body&gt;  \r\n&lt;\/html&gt;   \r\n<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-7-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78746\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-7-1.png\" alt=\"\" width=\"1287\" height=\"330\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-7-1.png 1287w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-7-1-300x77.png 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-7-1-1024x263.png 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-7-1-150x38.png 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-7-1-768x197.png 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/pasted-image-0-7-1-520x133.png 520w\" sizes=\"auto, (max-width: 1287px) 100vw, 1287px\" \/><\/a><\/p>\n<p><strong>Below are some of the Standard Colors and their <a href=\"http:\/\/www.unm.edu\/~tbeach\/IT145\/color.html\">color codes<\/a>:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Standard-Colors-as-per-the-W3C-standards.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-78750\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Standard-Colors-as-per-the-W3C-standards.jpg\" alt=\"Standard Colors\" width=\"786\" height=\"321\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Standard-Colors-as-per-the-W3C-standards.jpg 786w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Standard-Colors-as-per-the-W3C-standards-300x123.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Standard-Colors-as-per-the-W3C-standards-150x61.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Standard-Colors-as-per-the-W3C-standards-768x314.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/Standard-Colors-as-per-the-W3C-standards-520x212.jpg 520w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/a><\/p>\n<h2>Summary<\/h2>\n<p>HTML colors are of great importance as they provide a visual appeal to the web-page. A large variety of colors can be intermixed in order to make the HTML as attractive as possible.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1061,&quot;href&quot;:&quot;http:\\\/\\\/www.unm.edu\\\/~tbeach\\\/IT145\\\/color.html&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20250716184920\\\/https:\\\/\\\/www.unm.edu\\\/~tbeach\\\/IT145\\\/color.html&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 00:18:25&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-30 16:34:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-18 16:02:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-10 06:40:29&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-02-20 19:49:33&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-02 03:23:36&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-07 04:01:34&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-18 00:37:34&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-23 18:31:13&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-03-31 19:31:44&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-05 21:34:50&quot;,&quot;http_code&quot;:503},{&quot;date&quot;:&quot;2026-04-28 00:20:51&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-08 13:44:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-16 21:22:53&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-01 02:33:07&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-17 06:40:00&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-26 17:13:32&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-30 03:02:19&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-30 03:02:19&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using colors in an HTML web-page can make it aesthetic and attractive to the users. We will learn how to use HTML Colors and various HTML color codes. HTML Colors HTML colors can be&#46;&#46;&#46;<\/p>\n","protected":false},"author":10,"featured_media":78738,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22400],"tags":[22461,22460],"class_list":["post-78510","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-html","tag-html-color-codes","tag-html-colors"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>HTML Colors and Color Codes - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn HTML Colors tag &amp; HTML Color Codes - How to set font color, background color, border color, link color, using predefined colors.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/html-colors\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HTML Colors and Color Codes - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn HTML Colors tag &amp; HTML Color Codes - How to set font color, background color, border color, link color, using predefined colors.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/html-colors\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-27T03:30:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-26T07:53:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Colors.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HTML Colors and Color Codes - DataFlair","description":"Learn HTML Colors tag & HTML Color Codes - How to set font color, background color, border color, link color, using predefined colors.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/html-colors\/","og_locale":"en_US","og_type":"article","og_title":"HTML Colors and Color Codes - DataFlair","og_description":"Learn HTML Colors tag & HTML Color Codes - How to set font color, background color, border color, link color, using predefined colors.","og_url":"https:\/\/data-flair.training\/blogs\/html-colors\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2020-06-27T03:30:41+00:00","article_modified_time":"2024-07-26T07:53:02+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Colors.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/html-colors\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/html-colors\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33"},"headline":"HTML Colors and Color Codes","datePublished":"2020-06-27T03:30:41+00:00","dateModified":"2024-07-26T07:53:02+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/html-colors\/"},"wordCount":447,"commentCount":2,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/html-colors\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Colors.jpg","keywords":["HTML color codes","HTML colors"],"articleSection":["HTML Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/html-colors\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/html-colors\/","url":"https:\/\/data-flair.training\/blogs\/html-colors\/","name":"HTML Colors and Color Codes - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/html-colors\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/html-colors\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Colors.jpg","datePublished":"2020-06-27T03:30:41+00:00","dateModified":"2024-07-26T07:53:02+00:00","description":"Learn HTML Colors tag & HTML Color Codes - How to set font color, background color, border color, link color, using predefined colors.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/html-colors\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/html-colors\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/html-colors\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Colors.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2020\/06\/HTML-Colors.jpg","width":1200,"height":628,"caption":"HTML Colors"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/html-colors\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"HTML Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/html\/"},{"@type":"ListItem","position":3,"name":"HTML Colors and Color Codes"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/a90b082e16aa38d207212d22b0581f33","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dd6de0d647a0185cd6faf264e4ba860b0d85d08d7070766f9cd41bea5bb0b227?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team is passionate about delivering top-notch tutorials and resources on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. With expertise in the tech industry, we simplify complex topics to help learners excel. Stay updated with our latest insights.","url":"https:\/\/data-flair.training\/blogs\/author\/dfadteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/78510","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=78510"}],"version-history":[{"count":7,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/78510\/revisions"}],"predecessor-version":[{"id":142938,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/78510\/revisions\/142938"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/78738"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=78510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=78510"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=78510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}