html - 隐式计算弹性项目之间的空格?
问题描述
我有一个包含 3 个弹性项目的弹性容器,需要在最后一个项目上放置一个绝对定位的 div。并添加一个效果,使其左侧填充正好是 flex-items 之间空间的一半。我通过明确计算值来解决它。我想知道 calc 是否可以简化,但要避免减去父子宽度之和的部分。 如果有一些属性可以为您提供 flex 容器中的空白值?
或者有没有更好的方法来达到同样的效果。
*{
padding:0px;
border:0px;
box-sizing:border-box;
}
.parent{
width:200px;
height:20px;
display:flex;
justify-content:space-between;
position:relative;
}
.child{
font-size:14px;
width:50px;
height:100%;
background-color:blue;
}
.pop-over{
box-sizing:content-box;
width:50px;
height:120%;
position:absolute;
right:0;
top:0;
background-color:red;
opacity:.5;
padding-left:calc((100% - 150px) / 4)
}
<div class="parent">
<div class="child">
Child
</div>
<div class="child">
Child
</div>
<div class="child">
Child
</div>
<div class="pop-over">
</div>
</div>
解决方案
推荐阅读
- php - 如何下载从肥皂请求中收到的 ZipArchive
- php - 唯一约束返回类型不匹配
- javascript - 错误:找不到模块 'code-point-at' 和 npm install
- botframework - 在 facebook 中单击 GetStarted 按钮 2 分钟后如何发送主动消息
- css - Bootstrap 4.0 进度条中的垂直线标记
- react-native - SyntaxError:意外的标识符:导入类型
- c# - Xamarin HttpClient 在 Android 上首次启动时崩溃
- android - 带有 Kotlin 的 Android 上的简单光线追踪 - 不显示三角形
- android - 应用程序替换另一个?
- xamarin.forms - Pin 未显示正确的位置 google map api