We can write CSS Color Codes in three ways.
You need to play with color in webpage very often; Using CSS there are different ways to specify color for any HTML element.
We can form color using hex code, this is the most common approach that all web designer use in their web page designing.
<style> .splDiv { color: #000; background-color: #dcdcdc; } </style>
Here are some example of getting css color code using hex number
style="background-color:#df2020;"
style="background-color:#df8020;"
This approach is not so popular in web designing, but graphic designer most of the time use rgb or cmyk, so to match the exact color for any graphic we can use rgb in css code to form any color.
<style> .splDiv { color:rgb(186,32,24); background-color: rgb(255,255,255); } </style>
Here are some example of getting css color code using rgb number
style="background-color:rgb(128, 223, 32);"
style="background-color:rgb(223, 223, 32);"
Color names are NOT case-sensitive (it doesn't matter whether you use lowercase or UPPERCASE)
<style> .splDiv { color: white; background-color: red; } </style>
getting css color using color name as defined above.
style="background-color:red;"
style="background-color:green;"
You can define color to any html element, here are some examples
<div class="splDiv"></div> <span class="splDiv"></span> <p class="splDiv"></p>
You can use any css color code (hex, name, rgb), the result will be same.