0

How to add alt attribute using css ?

I would like to add a background image to the page with css but don't know how to add the "alt" attribute. Am not using the <img> tag of html.

18th Aug 2017, 7:31 PM
Peter
Peter - avatar
3 Réponses
+ 1
just add background color before background image ex: .somediv{ background: #fafafa; /* div will have this color as background if your image will not load */ background: url('your image') }
18th Aug 2017, 8:22 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
0
background image don't need to have alt attribute
18th Aug 2017, 8:18 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar
0
you can add a title to the container div. it will do the job.
18th Aug 2017, 9:26 PM
Muhammad Eltaher
Muhammad Eltaher - avatar