Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

CSS3 opacity property


May 06, 2021 CSS Reference Manual


Table of contents


CSS3 opacity property


Set the transparency level of a div element:

Div
{
opacity:0.5;
}

Try it out . . .
There are more examples at the bottom of this page.

Browser support

CSS3 opacity property CSS3 opacity property CSS3 opacity property CSS3 opacity property CSS3 opacity property

All major browsers support the opacity attribute.

Note: I E8 and earlier versions supported another filter property. Like: filter: Alpha (opacity -50)


Description of property definition and use

The Opacity property sets an element with a transparency level.

Default: 1
Inherited: no
Version: CSS3
JavaScript syntax: object .style.opacity=0.5


Grammar

opacity: value |inherit;

value describe
value Specify opacity.From 0.0 (completely transparent) to 1.0 (completely opaque)
inherit The value of the Opacity property should inherit from the parent element


CSS3 opacity property

More instances

Change the opacity of an element
This example demonstrates how JavaScript can be used to change the opacity of elements.