S
S
Sloth-invader2021-06-13 21:32:39
css
Sloth-invader, 2021-06-13 21:32:39

How to set transparency in CSS?

Let's say there is a code like this

<div class="opa">
<img src="image.png">
</div>

.opa{
opacity:0.7;
background:red;
}

Picture - white icon on a transparent background. Is it possible to somehow make the transparency not affect the image itself, but only the background ? Any crutch will do)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vovash, 2021-06-13
@Sloth-invader

background-color: rgba(255, 0, 0, 0.7);
where 0.7 -> alpha channel (transparency)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question