1
I’m having trouble overlapping the text in an image using flex box, could give me a light for this problem.
*, *:after, *:before{
margin: 0;
padding: 0;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
embed,
video,
iframe,
iframe[style]{
max-width: 100%;
height: auto;
}
img{
max-width: 100%;
vertical-align: middle;
margin: 0;
}
a img {
border: none;
margin: 0;
}
.container{display: flex; width: 100%;}
.content{width: 90%; margin:2% 5%;}
.slide{
padding: 0 !important;
display: flex;
position: relative;
/* background: #000; */
}
.slide_item{
display: flex;
width: 100%;
position: relative;
}
.slide_item.first{
display: block;
}
.slide_item_desc{
display: flex;
flex-direction: column;
align-content: center;
justify-content: center;
color: #fff;
position: absolute;
bottom: 33%;
}
.slide_item_desc h1{
font-size: 3.125em;
font-weight: 600;
margin-bottom: 50px;
}
.slide_item_desc a{
color: inherit;
text-decoration: none;
}
.slide_item_desc p a{
text-decoration: none !important;
}
.slide_item_desc p{
font-size: 0.825em;
color: #eee;
}
.btn {}
.btn_golden{
border: 5px solid #F7C043;
padding: 15px 60px;
font-size: 1.25em;
font-weight: bold;
text-transform: uppercase;
background: none;
}
<section class="container slide">
<article class="slide_item content">
<div class="slide_item">
<a href="">
<picture>
<source srcset="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ1X23O4pvIMQ9kKLJwLQfq4tKHkTTHqyi8SZ8feRv-sAlzzDru4w" media="(min-width: 960px)">
<img srcset="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ1X23O4pvIMQ9kKLJwLQfq4tKHkTTHqyi8SZ8feRv-sAlzzDru4w" alt="" title="" />
</picture>
</a>
<p><a href="">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Commodi, labore!</a></p>
<h1><a href="http://">Lorem ipsum dolor sit amet.</a></h1>
<p><a class="btn btn_golden" href="">Call to Action</a ></p>
</div>
</article>
</section>
If possible post the code you have tried.
– Valdeir Psr
I went to codepen, sorry for the delay follow the link https://codepen.io/lopesboa/pen/PRrmME
– Lopes Boa
Apply a
position:absolute
within all elements ofdiv.slide_item
– Valdeir Psr
If I apply position:Absolute to div.slide_item td is floating, just like image tbem, so I applied only to div.slide_item_desc which is where all the text is
– Lopes Boa
Then you just fix the
top
andleft
of the elements within of div cited. You can also add the image as background ofdiv.slide_item
– Valdeir Psr