❐CSS❐

❐wD Learn

CSS

CSS Introduction

CSS Selectors

CSS Color

CSS Background

CSS Border

CSS Margin

CSS Padding

CSS Box Model

CSS Text

CSS Font

CSS Link

CSS List

CSS Overflow

CSS Display

CSS Combinators

CSS Pseudo-classes

CSS Navigation Bar

CSS Hover

CSS Z-index

CSS Media Queries

CSS Shadow

CSS 2D Transform

CSS Animations

CSS Button

CSS FlexBox

CSS Grid

CSS Pagination

CSS Colors The color property of CSS helps to set the color of the HTML element(s). This helps to set the foreground color of text, text decorations, and borders.

Syntax


/* Syntax
selector {
color: value
}
*/
selector {
/* colorname can be any colour, such as red, blue, yellow, purple, green, etc. */
color: colorname
}
RGB RGB stands for “Red, Green, Blue,” and it defines the colour value by taking three (red, green, blue) arguments.

Syntax


selector {

color: rgb(red, green, blue);

}

Example


<head>
<style>
h1 {

color: rgb(0, 0, 0);
/* red:0, green:0, blue:0 */

}
h2 {

color: rgb(255, 255, 255);
/* red:255, green:255, blue:255 */

}
h3 {

color: rgb(30, 150, 220);

}
</style>
</head>
<body>
<h1>Code with me</h1>
<h2>A Developer</h2>
<h3>Nice to meet you</h3>
</body>
</html>
RGBA Similar to RGB, in RGBA, a stands for alpha value, which defines the opacity of the color. The alpha value lies between 0 and 1.

Syntax


selector {

color: rgba(red, green, blue, opacity);

}

Example


<head>
<style>
h1 {

color: rgba(0, 0, 0, 0.8);
/* red:0, green:0, blue:0, Alpha: 0.8 = 80% */

}
h2 {

color: rgba(255, 255, 255, 0.6);
/* red:255, green:255, blue:255 */

}
h3 {

color: rgba(30, 150, 220, 0.6);
/* red:30, green:150, blue:200, alpha:60% */

}
</style>
</head>
<body>
<h1>CodeWithme</h1>
<h2>A Developer</h2>
<h3> founder </h3>
</body>
</html>