+ 1

How To Add Alt text on images

I want to add alt text to images while using CSS but unable to do , I am using these following code , and wants to add alt text to image , how can i do <head><style>.user { display: inline-block; width: 150px; height: 150px; border-radius: 50%; background-repeat: no-repeat; background-position: center center; background-size: cover; } .one { background-image: url('http://placehold.it/400x200'); } </style></head> <body><div class="user one"></div></body> https://code.sololearn.com/W8B7ux8ZH1bJ/?ref=app

20th Feb 2018, 6:54 AM
Basudev
Basudev - avatar
2 Answers
+ 5
Personally I would use the title attribute for the containing div instead of an alt in the css.
20th Feb 2018, 7:01 AM
Memphis Reigns
Memphis Reigns - avatar
+ 1
but I need alt so how can I do that
20th Feb 2018, 9:00 AM
Basudev
Basudev - avatar