+ 1

Change Pic Opacity in CSS?

How can I change a picture's opacity/brightness w/o JS?

5th Sep 2017, 7:53 PM
Jayzn
Jayzn - avatar
4 Respuestas
+ 2
@ css tab write: img{ opacity: value;} (value range: 0<=value<=1) Example: img{ opacity: 0.5;} result: your image will be 50% opaque
5th Sep 2017, 8:04 PM
Haris
Haris - avatar
+ 1
@Haris when doing like so, the text itself gets a lower opacity: div.background1{ background-image:url("https://upload.wikimedia.org/wikipedia/commons/9/9e/Cuban_crisis_map_missile_range.jpg"); background-repeat:no-repeat; background-position:center; opacity:0.5; } I will try it with img now, but I think it's strange that text belongs to background... thx! couldn't find this that easily in the web!
6th Sep 2017, 5:46 AM
Jayzn
Jayzn - avatar
+ 1
No problem :) Css course here has an opacity lesson though I don't remember where exactly. Try it if you haven't, it's great.
6th Sep 2017, 5:57 AM
Haris
Haris - avatar
0
your text effect by opacity, because your other elements wrap by your background tag
11th Oct 2017, 8:49 PM
林偉雄
林偉雄 - avatar