Amit Sharma
Amit Sharma

Reputation: 13

Text overlay on image

I am using master slider plugin.slide1 2 3 all have different classes. Trying to place text over the image but not displaying. I tried this but could not see anything

.classnameslide1:before {
content: 'Text inserted before via CSS';
 }  
and  
.classnameslide1:after{
content: 'Text inserted before via CSS';
 }

Upvotes: 0

Views: 77

Answers (1)

Dinesh Kumar
Dinesh Kumar

Reputation: 503

Use position relative of parent and absolute for pseudo-elements, like,

.classnameslide1 {position: relative; z-index: 1}
.classnameslide1:after {content: 'Text inserted before via CSS'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3}

Upvotes: 1

Related Questions