Languages
[Edit]
EN

CSS - set element opacity

0 points
Created by:
MindOfMadness3
306

In this article, we would like to show you how to set element opacity using CSS.

Quick solution:

div {
  opacity: 50%;
}

or:

div {
  opacity: 0.5;
}

 

Practical example

In this example, we set the opacity value for the img element to 50%.

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<head>
  <style>

    img {
      opacity: 50%;
    }

  </style>
</head>
<body>
  <img src="https://dirask.com/static/bucket/1624644642609-mbQLqBEYJX--example-img-730w.jpg" />
</body>
</html>

References

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join