+ 3

Can we write text on image using HTML? If yes, how ?

1st Nov 2019, 6:52 PM
Bhanu Gupta
Bhanu Gupta - avatar
7 Answers
+ 3
Use z-index to push your image to background. Add text and give margins to text to set it on the image.
1st Nov 2019, 7:18 PM
Chetali Shah
Chetali Shah - avatar
+ 1
you can use position property like below: HTML: <div class="image"> <img src="image.png" alt="" /> <h2>Text over the image</h2> </div> CSS: .image { position: relative; width: 100%; /* for IE 6 */ } h2 { position: absolute; top: 200px; left: 0; width: 100%; }
4th Nov 2019, 4:41 AM
Shaili Shah
Shaili Shah - avatar
1st Nov 2019, 7:41 PM
Anton Böhler
Anton Böhler - avatar
0
You can create a container with position relative with the image in it, then for the text a new div inside the containter with with position absolute. https://www.w3schools.com/howto/howto_css_image_text.asp
3rd Nov 2019, 9:59 AM
CodeX
CodeX - avatar
- 2
you can use an canvas. draw the image on the canvas then draw text ontop.
1st Nov 2019, 7:00 PM
Anton Böhler
Anton Böhler - avatar