Smal SEO Tool

CSS Opacity

The opacity property specifies the transparency of an element.

How Opacity Works

The opacity property can take a value from 0.0 - 1.0. The lower the value, the more transparent:

  • 1: The element is fully opaque (this is the default).
  • 0.5: The element is 50% transparent.
  • 0: The element is completely transparent (and invisible).

Example

css
.box {
  opacity: 0.5;
}
Try it Yourself »

Opacity on Hover

A common use case is to change the opacity of an element on hover.

Example

css
img {
  opacity: 0.5;
}

img:hover {
  opacity: 1.0;
}
Try it Yourself »

Test Yourself with an Exercise

What value of `opacity` makes an element completely transparent?