EN
CSS - set element opacity
0
points
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>