Which tag should be used to write text on an image on the web page ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Which tag should be used to write text on an image on the web page ?

15th Jul 2018, 5:31 AM
Vishal Soni
Vishal Soni - avatar
4 Answers
+ 1
I don't get it u want an alternative like Alexander Sokolov said or u want image as background and want other elements on it if u want this set image as background using css to wrapping div like <div id ="wrapper"> </div> css: #wrapper { background-image: url("image.png"); }
15th Jul 2018, 6:05 AM
Yugabdh
Yugabdh - avatar
+ 5
Hello, Vishal Soni ! The alt attribute sets the alternative text for images. This text allows you to get text information about the image when the download of images is disabled in the browser. Since images are downloaded after the browser receives information about it, the text replacing the picture appears earlier. And already as you load the text will be replaced by the image. Good luck with programming on SoloLearn! https://www.sololearn.com/learn/HTML/1030/?ref=app
15th Jul 2018, 5:34 AM
Alexander Sokolov
Alexander Sokolov - avatar
+ 1
https://code.sololearn.com/WUAdbd6f6c6J/?ref=app
15th Jul 2018, 6:14 AM
Calviղ
Calviղ - avatar
0
if you are using plain <img>, you can use <span>, <p>, <div> to place the text in. if the text belongs clearly to the image (i.e. image caption in article), you can use <figure> to wrap <img> and <figcaption>. => helps search engines to understand that the text is additional info that belongs to the image. => better indexing in search engines and more traffic (via image search).
15th Jul 2018, 5:48 AM
wenz
wenz - avatar