Css 使用变换后图元留下的空间

Css 使用变换后图元留下的空间,css,Css,我们有10个盒子。在第五个盒子上悬停后,左边的盒子向左移动-81px,右边的盒子向右移动81px 因此,没有被转换的那个,我们悬停在上面的那个,仍然有和以前一样的宽度,即使它的宽度被设置为100%。有人能给我解释一下为什么不能从中间的元素中使用剩下的空间吗? 你可以在行动中看到它 谢谢。元素转换,只有视觉渲染。我知道div看起来应该有更多的空间,可以扩展,但实际上它没有。好吧,这就是我所怀疑的,但是你知道有什么解决办法吗,或者绝对定位是我在这个场景中唯一的朋友吗?我会看看flexbox。 //c

我们有10个盒子。在第五个盒子上悬停后,左边的盒子向左移动-81px,右边的盒子向右移动81px

因此,没有被转换的那个,我们悬停在上面的那个,仍然有和以前一样的宽度,即使它的宽度被设置为100%。有人能给我解释一下为什么不能从中间的元素中使用剩下的空间吗?

你可以在行动中看到它


谢谢。

元素转换,只有视觉渲染。我知道div看起来应该有更多的空间,可以扩展,但实际上它没有。好吧,这就是我所怀疑的,但是你知道有什么解决办法吗,或者绝对定位是我在这个场景中唯一的朋友吗?我会看看flexbox。
//css:
.boxwrapper{
  display:block;
  >div{
    display:inline-block;
    border: solid 1px grey;
    width:auto;
    padding:20px;
    background-color:white;
    &.before{
      transform:translateX(-20px);
    }&.after{
      transform:translateX(20px);
    }
  }
}

//html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<body>
<div class="boxwrapper">
  <div data-number="1" id="box" onmouseover="mouseoverbox(event)" onmouseleave="removeAll()">BOX 1</div>
  <div data-number="2" id="box" onmouseover="mouseoverbox(event)" onmouseleave="removeAll()">BOX 2</div>
  <div data-number="3" id="box" onmouseover="mouseoverbox(event)" onmouseleave="removeAll()">BOX 3</div>
  <div data-number="4" id="box" onmouseover="mouseoverbox(event)" onmouseleave="removeAll()">BOX 4</div>
  <div data-number="5" id="box" onmouseover="mouseoverbox(event)" onmouseleave="removeAll()">BOX 5</div>
</div>
</body>
</html>