html – Space between border parent div and child div’s


I am getting white space between my parent div and child div when adding a border to the parent div. I have tried everything (overflow, (min) height/width, increasing border width) but nothing works. I have the same problem with images when.

Does someone know how I can fix this?

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

body,
html {
  margin: 0;
  padding: 0;
}

.container {
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

.big-box {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  background: white;
  border: 5px solid darkgreen;
  overflow: hidden;
  height: 100px;
  width: 100px;
}

.box {
  flex: 1 1 33%;
  min-height: 100%;
  min-width: 100%;
  background: black;
  color: white;
  border: none;
  overflow: hidden;
}
<div class="container">
  <div class="big-box">
    <div class="box">
      <h2>hello</h2>
    </div>
  </div>
</div>
<body>
<div class="container">
    <div class="big-box">
        <div class="box">
            <h2>hello</h2>
        </div>
    </div>
</div>
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body,
html {
    margin: 0;
    padding: 0;
}

.container {
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    height: 100vh;
    width: 1100px;
}

.big-box {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    background: white;
    border: 5px solid darkgreen;
    overflow: hidden;
    height: 100px;
    width: 100px;
}

.box {
    flex: 1 1 33%;
    min-height: 100%;
    min-width: 100%;
    background: black;
    color: white;
    border: none;
    overflow: hidden;
}



Source link

Latest articles

Related articles

Leave a reply

Please enter your comment!
Please enter your name here