FANDOM


The opacity property is used in CSS and certain HTML elements. This property specifies the transparency of an element (the degree to which the background behind the element is overlaid).


Values

  • <number> - A number from 0.0 to 1.0. Any value smaller or larger will be clamped to this range.
  • 0 - The element is fully transparent (invisible).
  • 0 < number < 1 - The element is translucent (background can be seen).
  • 1 - The element is fully opaque (solid).


HTML examples:

<pre style="opacity:0.3;">
Check out the transparency of this box.
<pre style="opacity:0.5;">
Check out the transparency of this box.
<pre style="opacity:0.8;">
Check out the transparency of this box.


CSS pre example:

pre {
     opacity:0.5;
}