CSS Colors



The Color property is used to define the text color.

There are Three formets are Here.

  • color keyword - like red,green,yellow
  • RGB - like rgb(275, 0, 0)
  • HEX - like #ff0700

Color Keyword

CSS defines some color keywords like red,blue,yellow,green,purple like more.

Example

<!DOCTYPE html>
    <html>
    <head>
    <title>CSS Color Names</title>
    <style>    
        h1 {
            color: yellow;
        }
        p {
            color: red;
        }
    </style>
    </head>
    <body>
        <h1>This is a heading</h1>
        <p>This is a paragraph.</p>
    </body>
    </html>
  


Click on the "Run This Code" button to see how it works.

CSS RGB Colors

The rgb() color function have three comma values.which specify the red,green,blue.

Example

<!DOCTYPE html>
<html>
<head>
<title> CSS using RGB Values</title>
<style>    
    h1 {
        color: rgb(300, 155, 0);
    }
    p {
        color: rgb(185, 200, 300);
    }
</style>
</head>
<body>
    <h1>This is a heading</h1>
    <p>This is a paragraph.</p>
</body>
</html>


Click on the "Run This Code" button to see how it works.

HEX Colors

The hex is the commonly used method to present color on the website.it represent color using six-digit code.

Example

<!DOCTYPE html>
	<html>
	<head>
	<title> Colors in CSS using Hexadecimal Notation</title>
	<style>    
		h1 {
			color: #afa100;
		}
		p {
			color: #80ff00;
		}
	</style>
	</head>
	<body>
		<h1>This is a heading</h1>
		<p>This is a paragraph.</p>
	</body>
	</html>
	


Click on the "Run This Code" button to see how it works.




CSS

Welcome CSS Syntax CSS Selectors CSS ADD css CSS Borders CSS Backgrounds CSS Colors CSS Padding CSS Margin CSS Fonts CSS Text CSS Outline CSS Box-Model CSS Height&Width CSS Icons CSS Links CSS Lists CSS Display CSS Tables CSS Position CSS Overflow CSS Align CSS Float CSS Inline-block CSS Opacity CSS Image-Gallery CSS Navigation Bar CSS Dropdowns CSS Cursors CSS Forms CSS Pseudo-classes CSS Pseudo-elements

CSS3 FEATURES

CSS Gradients CSS shadows CSS 2D Transforms CSS 3D Transforms CSS Animations CSS Media Queries CSS Flexbox CSS important CSS Units