1
I have two horizontally linear div using display:flex. When applying a width of 250px on one and 100% on the other 250px loses the size of 250px always getting a few pixels less.
If I switch to 300px, 100px, 550px, it does not matter, it is always missing a few pixels difference of the indicated size and the amount of pixel missing always varies, it is not a fixed amount.
I’ve taken the margin, padding, top everything and applied the box-border too and remains the same.
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
.container {
display: flex;
}
.div1 {
background-color: blueviolet;
width: 250px;
height: 100px;
}
.div2 {
background-color: rgb(0, 166, 231);
width: 100%;
height: 100px;
}
</style>
</head>
<body>
<div class="container">
<div class="div1"></div>
<div class="div2"></div>
</div>
</body>
</html>
Thank you very much for the answer, I imagined that a solution would be this of Calc() but I wanted to know exactly what is happening to this problem. Thank you for the reply.
– Fernando Americo
@Fernandoamerico if the answer solves the problem remember to mark it as accepted, so your question is not open without accepted answer. Just click on the icon below the little arrows next to the answer ;)
– hugocsl
Sure, sure, thanks again.
– Fernando Americo