How to change background image opacity in HTML not CSS? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to change background image opacity in HTML not CSS?

Every time i want to change the opacity of a background image, i must have open CSS and write code as <style... and so on. Is there anyway i could do this using only HTML??

1st Jan 2019, 7:16 AM
Arain Zada
Arain Zada - avatar
4 Answers
+ 3
In almost all html tags you can use the "style" property to change the appearance of that element. See the example of Brains: <div style = "css inline here"> </ div> Within the "style" property you will need to use the css syntax in the same way as you use it in style sheets. I'll give you a more direct example: <div style = "backgound-color: red; color: white"> this is an example </ div> As you can see I changed the background in red and the text will be blank P.S. note that this type of writing is strongly discouraged, you should use style sheets
1st Jan 2019, 10:01 PM
Simone
Simone - avatar
+ 7
you could use inline css <div style="inline css here" ></div>
1st Jan 2019, 9:16 AM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
+ 3
Thanks simone
2nd Jan 2019, 4:23 AM
Arain Zada
Arain Zada - avatar
+ 1
Can you explain? <style> is used in CSS but i am asking for html only.
1st Jan 2019, 1:18 PM
Arain Zada
Arain Zada - avatar