Back to the Seattle Mariners Newsfeed

How to Set Opacity of Images, Text & More in CSS (2024)

Related Topics: opacity, Christina Perricone

Opacity — and its opposite, transparency — can be used in website design to create contrast and reinforce a brand’s identity.

Like horizontal scrolling, web textures, and many other web design techniques, opacity and transparency are best used sparingly and intentionally. Below we’ll walk through how to control the opacity of different elements, including:

  • background
  • text
  • border
  • image
  • gradient
  • color

How to Set Opacity in CSS

To set the opacity of a background, image, text, or other element, you can use the CSS opacity property. Values for this property range from 0 to 1.