3
Good afternoon. At this time I have 2 Ivs, 1 of them visible and the other hidden, being visible when I do the first.
I would like, when revealing the div with text, the background of this fills the entire div that contains the image.
I’m sorry if it’s a basic question.
I intend to do this through css.
Thank you
@media only screen and (min-width: 769px) {
.gridContainer {
width: 88.2%;
max-width: 1232px;
padding-left: 0.9%;
padding-right: 0.9%;
margin: auto;
}
#mainWrapper{
width:100%;
}
.contentor{
display:block;
width:33.3%;
height:auto;
position:relative;
margin:0;
float:left;
}
.imagem{
display:block;
position:relative;
width:100%;
height:auto;
left:0;
top:0;
}
.texto{
display:block;
z-index:100;
position:absolute;
font-size: 3em;
font-weight:bold;
left:50%;
top:35%;
margin-right: -50%;
transform: translate(-50%, -50%);
text-align:center;
background: rgba(153, 102, 0, 0.6);
transition: opacity 2s; /* efeito trans */
opacity:0;
}
.contentor:hover .texto{
opacity:1;
}
<div>
<div class="contentor">
<img class="imagem" src="IMGS/index_amb.jpg"/>
<p class="texto">texto por cima</p>
</div>
<div class="contentor">
<img class="imagem" src="IMGS/index_fuller.jpg"/>
<p class="texto">texto por cima</p>
</div>
<div class="contentor">
<img class="imagem" src="IMGS/index_ft_rain.jpg"/>
<p class="texto">texto por cima</p>
</div>
<div class="contentor">
<img class="imagem" src="IMGS/index_manual.jpg"/>
<p class="texto">texto por cima</p>
</div>
<div class="contentor">
<img class="imagem" src="IMGS/index_pecados.jpg"/>
<p class="texto">texto por cima</p>
</div>
<div class="contentor">
<img class="imagem" src="IMGS/index_e_r.jpg"/>
<p class="texto">texto por cima</p>
</div>
</div>
I believe the solution is practically ready here: http://answall.com/q/56996/70
– Bacco
Is this what you want? -> https://jsfiddle.net/4nzpkgu6/
– Sergio
Sérgio, that’s it but occupying the entire div, in this case only occupies horizontally :)
– David Monteiro
David, so -> https://jsfiddle.net/4nzpkgu6/1/ ? If you’re not, explain it better... Add a screenshot of how you want it?
– Sergio
That’s enough, thank you :D
– David Monteiro
Related: http://answall.com/questions/26684/
– ptkato