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:
xxxxxxxxxx
1
div {
2
opacity: 50%;
3
}
or:
xxxxxxxxxx
1
div {
2
opacity: 0.5;
3
}
In this example, we set the opacity
value for the img
element to 50%
.
xxxxxxxxxx
1
2
<html>
3
<head>
4
<style>
5
6
img {
7
opacity: 50%;
8
}
9
10
</style>
11
</head>
12
<body>
13
<img src="https://dirask.com/static/bucket/1624644642609-mbQLqBEYJX--example-img-730w.jpg" />
14
</body>
15
</html>