CSS - Colors

CSS - Colors

  • CSS uses color values to specify a color in the web page / website. 
  • Typically, these are used to set a color for an element (i.e., its text). 
  • They can also be used to affect the color of borders and other decorative effects.
  • We can specify the colors in various format.




Hex Code



RGB Absolute




aqua, black, etc.


Attributes :

P //Paragraph

Sample Code :

<!DOCTYPE html>
            Welcome To Wikitechy
style="color:rgb(255, 165, 0)">
            Best E Learning Website In The World
            You Can Learn All The Technologies Easily

Code Explanation :

    Here, we are Applying hexadecimal color for h2 tag.

  • Note: RGB values can also be assigned using hexadecimal color values in the form of: #RRGGBB, where RR (red), GG (green) and BB (blue) are hexadecimal values between 00 and FF (same as decimal 0-255).

    Here, h2 element was defined for the statement “Best E-Learning Website In The World” whose RGB Colors values specify its color values based on the formula (red, green, blue).

    <h2 style="color:blue;"> here we are applying blue color for h2 tag .

Output :


    Here Hexadecimal color value is applied for Welcome To Wikitechy.

    Over here , the RGB color values is applied for Best E-Learning Website in the World.

    The Text “You Can Learn All the Technologies Easily” will appear in blue color.