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 opacity attribute



The opacity property in CSS is used to set the transparency level of an element. The value of opacity ranges from 0 (completely transparent) to 1 (completely opaque).

Basic Usage

Here' how you can use the opacity property:

css
.element {
    opacity: 0.5; /* 50% transparent */
}

Example

Below are a few examples of different opacity values:

css
/* Completely opaque (default) */
.opaque {
    opacity: 1;
}

/* 75% opacity */
.seventy-five {
    opacity: 0.75;
}

/* 50% opacity */
.fifty {
    opacity: 0.5;
}

/* 25% opacity */
.twenty-five {
    opacity: 0.25;
}

/* Completely transparent */
.transparent {
    opacity: 0;
}

Using the opacity property, you can create various transparency effects, which can be useful for overlays, hover effects, and more. Let me know if you need more details or examples!




All rights reserved | Privacy Policy | Sitemap