Coding Schools


 
Python | C Sharp | Azure AI | HTML | JavaScript | CSS | SQL Server
How to add CSS in HTML
Types of CSS Files
Flex in CSS
Media Query in CSS
CSS - background attribute
CSS - border
css - border-image
CSS align attributes
CSS color attribute
CSS cursor attribute
CSS display attribute
CSS font attributes
CSS height and max-height
CSS width and max-width
CSS padding attributes
CSS margin attributes
CSS mask attributes
CSS overflow attributes
CSS opacity attribute
CSS text decoration attributes
CSS visibility attribute
CSS word attributes
CSS z-index attribute

CSS color attribute



The color attribute in CSS is used to set the color of text content inside an element. Here's how you can use it:

Basic Usage

You can set the color using predefined color names:

css
.element {
    color: blue; /* Predefined color name */
}

Hexadecimal Colors

You can also use hexadecimal values:

css
.element {
    color: #ff5733; /* Hexadecimal color value */
}

RGB Colors

For more control, you can use RGB color values:

css
.element {
    color: rgb(255, 87, 51); /* RGB color value */
}

RGBA Colors

If you need transparency, you can use RGBA values:

css
.element {
    color: rgba(255, 87, 51, 0.7); /* RGBA color value with alpha for transparency */
}

HSL Colors

You can also use HSL (Hue, Saturation, Lightness) values:

css
.element {
    color: hsl(9, 100%, 60%); /* HSL color value */
}

HSLA Colors

Similarly, you can add transparency with HSLA values:

css
.element {
    color: hsla(9, 100%, 60%, 0.7); /* HSLA color value with alpha for transparency */
}

Feel free to mix and match these to achieve the color scheme you want for your project. Let me know if you need any more examples or explanations!




All rights reserved | Privacy Policy | Sitemap