-1

I am trying to fit 100% a blue square in a container but i see a little white space to the right and bottom, between the shape and the border, even if i have paddings and margins to zero and width and height to 100%. Why is that happening;

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

.cont {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.cube {
  position: relative;
  width: 300px;
  height: 300px;
  border: 1px solid black;
}

.face {
  position: absolute;
  width: 100%;
  height: 100%;
}

.face1 {
  background-color: blue;
}
<!DOCTYPE html>
<html lang="en">

<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>
  <link rel="stylesheet" href="style.css">
</head>

<body>
  <div class="cont">
    <div class="cube">
      <div class="face face1"></div>
    </div>
  </div>
</body>

</html>

Picture

Picture of the Problem

akis
  • 1
  • 2

1 Answers1

0

It is because of the height command you wrote to your class named cont. if you delete it it will fill up completely

  • This may help : https://stackoverflow.com/q/28779631/16846346 for your deleted question about a space in input after 4 digits – Rana Oct 14 '21 at 15:02