CSS Colors

In this tutorial, we will learn about CSS colours. CSS colors are use to mention colors for HTML elements. For example, you want to set color of paragraph element or you want to set the background colour of a specific portion of the web page.

In CSS we can define color for differnt HTML elements using Color name, RGB, HEXA, RGBA, HSLA values.

There is a total of 140 standard colour names like black, blue, green etc. which you can use in CSS. Click to check colour names. Check This example using standard colour names.

<html>
     <head>
        <style>
           h4{
           color:red;
           font-size:25px;
           }
           .frame{
             border:1px solid green;
             border-radius:10px; 
             padding:10px;
           }
       </style>
     </head>
     <body>
        <h4>This is H4 Tag</h4>
        <p class="frame">Hello This is P Tag</p>
    </body>
</html>

Defining color using HEXA value:

We can also define the color of the HTML element in CSS using Hexadecimal values. click to check Hexa Values of colours. Example using HEXA Values:

<html>
     <head>
        <style>
           h4{
           color:#56A5EC;
           font-size:25px;
           }
           .frame{
             border:1px solid #79BAEC;
             border-radius:10px; 
             padding:10px;
           }
       </style>
     </head>
     <body>
        <h4>This is H4 Tag</h4>
        <p class="frame">Hello This is P Tag</p>
    </body>
</html>
Spread the love