How to put words on images in CSS? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to put words on images in CSS?

How do you put words on images in CSS? Also how do you change the size of a image using background-image?

22nd Jul 2018, 10:34 PM
Eddy
Eddy - avatar
6 Answers
+ 7
#put words on images: just create an element with no background,write the text in it and position it over the image. #change image background size div{ width:80px; height:80px; background-image:url(link); background-size:100% 100% ; }
22nd Jul 2018, 10:50 PM
᠌᠌Brains[Abidemi]
᠌᠌Brains[Abidemi] - avatar
22nd Jul 2018, 11:04 PM
Roel
Roel - avatar
+ 5
CSS img{ Position: absolute; } H1{ Position: relative ; Top:5%; }
2nd Sep 2019, 2:08 AM
SurajGuptaOnline
SurajGuptaOnline - avatar
+ 2
to show the text on the image use this: img {     position: absolute;     left: 0px;     top: 0px;     z-index: -1; } to understand more: The z-index property specifies the stack order of an element. An element with greater stack order is always in front of an element with a lower stack order. Note: z-index only works on positioned elements (position:absolute, position:relative, or position:fixed). and to change the size follow what brains said
23rd Jul 2018, 12:38 AM
Guezi Louay
Guezi Louay - avatar
+ 1
Is it possible to write a text over the image thats at the bottom center and enhance the size of the word? And is it possible to align word at the bottom center on the image?
24th Jul 2018, 2:48 AM
Eddy
Eddy - avatar
6th Aug 2018, 9:54 PM
Manny Pereira
Manny Pereira - avatar