How to put text inside a div in front of its overlay? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to put text inside a div in front of its overlay?

Hey I've created a div with a css background-image and a headline inside the div. To make the image look better Ive used div:before as an overlay over the image, but as the text is inside the div the overlay lays also upon the text. is there a way to keep the text in front of the overlay without moving it out of the div? (z-index doesnt work)

11th Aug 2018, 3:14 PM
lechickenburGER
lechickenburGER - avatar
2 Answers
+ 2
put the text in div:after using content:"text"
11th Aug 2018, 3:28 PM
Calviղ
Calviղ - avatar
+ 1
Thanks that makes sense :D
11th Aug 2018, 3:50 PM
lechickenburGER
lechickenburGER - avatar