0
I’m having a problem, I’m trying to align several Ivs inside a container, more specifically 3, what I want is to get them all aligned on each other’s side, but one ends up going down and I don’t know how to solve it, follow the code:
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
html, body{
height: 100%;
}
.clear{
clear: both;
}
.container{
width: 100%;
max-width: 764px;
margin: 20px auto;
padding: 40px 0;
border: 3px solid rgb(220, 220, 220);
;
}
.img-wraper{
width: 33.3%;
margin: 10px;
padding-top: 23.3%;
padding-left: 23.3%;
float: left;
/* background-color: #ccc; */
position: relative;
}
.img{
border: 2px solid black ;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-position: center;
background-size: contain;
background-repeat: no-repeat;
}
<body>
<div class="container">
<div class="img-wraper">
<div class="img" style="background-image:url('imagens/imagem1.jpg');"></div>
</div> <!--img-wraper-->
<div class="img-wraper">
<div class="img" style="background-image:url('imagens/imagem1.jpg');"></div>
</div> <!--img-wraper-->
<div class="img-wraper">
<div class="img" style="background-image:url('imagens/imagem1.jpg');"></div>
</div> <!--img-wraper-->
<div class="clear"></div>
</div> <!--container-->
</body>
create a functional example showing how to understand better
– Ricardo Pontual
@Ricardopunctual he even created a 100% reproducible example. But he lacked formatting. He still doesn’t have much intimacy with the site. I helped editing his question. Got filet!
– LipESprY
now yes, when I saw the question there was only the code
– Ricardo Pontual
Those
<div>
possessmargin
what influence on Box Model (Cash Model, https://developer.mozilla.org/en-US/docs/Web/CSS/box_model) and it turns out that the width and height of the element are all summed up, thus not fitting in the parent container. This is the same thing you want to get in the car through the door, following the reasoning the car is big and the door is small, so the car won’t get in, the same thing happens in your example.– user181348