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 the colour of paragraph element or you want to set the background colour of a specific portion of the web page.
In CSS we can define the colour for different HTML elements using the 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 colour using HEXA value:
We can also define the colour 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>
Parvesh Sandila is a results-driven tech professional with 8+ years of experience in web and mobile development, leadership, and emerging technologies.
After completing his Master’s in Computer Applications (MCA), he began his journey as a programming mentor, guiding 100+ students and helping them build strong foundations in coding. In 2019, he founded Owlbuddy.com, a platform dedicated to providing free, high-quality programming tutorials for aspiring developers.
He then transitioned into a full-time programmer, where his hands-on expertise and problem-solving skills led him to grow into a Team Lead and Technical Project Manager, successfully delivering scalable web and mobile solutions. Today, he works with advanced technologies such as AI systems, RAG architectures, and modern digital solutions, while also collaborating through a strategic partnership with Technobae (UK) to build next-generation products.
