I'm trying to position a text box on an image through z index, to get something like this: link
At this point the text appears after the image (since it is in a div with 100% width). I wanted the text to appear superimposed on the image.
What am I doing wrong? Thanks
My code:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style>
#intro {
width:100%;
float:left;
padding-right:3%;
padding-top:3%;
padding-bottom:3%;
background-repeat:no-repeat;
background-size:100%;
position:relative;
z-index:50;
}
.txt_ilustracao {
display:block;
width:38%;
margin: 7% 3% 3% 7%;
float:right;
color:black;
background-color: rgba(255, 255, 255, 0.6);
padding:5%;
position:relative;
z-index:100;
}
.txt_ilustracao1 {
font-size:2.5em;
margin-top: 10%;
margin-bottom:3%;
text-align:center;
}
.txt_ilustracao2 {
font-size:1.8em;
margin-top:9%;
text-align:center;
}
</style>
<div id="intro"><img src="IMGS/index_fundo_pb.jpg"></div>
<div class="txt_ilustracao">
<div class="txt_ilustracao1">
asdfgcvhbjklçjh erdtfyguhijopoçlikujhtgrfed<br>
asdfgcvhbjklçjh erdtfyguhijopoçlikujhtgrfed <br>
asdfgcvhbjklçjh erdtfyguhijopoçlikujhtgrfed</div>
<div class="txt_ilustracao2">asdfgcvhbjklçjh erdtfyguhijopoçlikujhtgrfed
asdfgcvhbjklçjh erdtfyguhijopoçlikujhtgrfed.<br><br>
asdfgcvhbjklçjh erdtfyguhijopoçlikujhtgrfed</div>
</div> <!-- intro -->