html - 父包装时 Flex 子更改
问题描述
首先对不起我的英语,
我问我是否可以更改 flex div 中最后一个孩子的样式,当这个孩子进入行(换行)时。
我想要的正是修改最后一个孩子(演示中的 .flexChild)以在空间周围更改 justify-content 或在用户使用移动设备或调整窗口大小时添加填充
(没有媒体查询)
.parent {
display: flex;
align-items: center;
flex-wrap: wrap;
width: 100%;
height: 100px;
background: red;
}
.child {
padding: 0 20px;
background: green;
border: 1px solid black;
}
.flexChild {
background: yellow;
display: flex;
min-width: 200px;
flex-wrap: wrap;
flex: 1 1 auto;
justify-content: space-between;
}
<div class="parent">
<div class="child">
Testtestesttest
</div>
<div class="child">
testtesttestt
</div>
<div class="child">
testesttestest
</div>
<div class="child flexChild">
<div class="left">
<button>1</button>
<button>2</button>
</div>
<div class="right">
<button>3</button>
</div>
</div>
</div>
解决方案
推荐阅读
- javascript - window.showOpenFilePicker polyfill
- yahoo-finance - 使用 Inspect 从图表中提取数据
- ios - Flutter - 推送通知以调试模式出现在 iOS 中,但不在发布模式下
- c - 我希望有人可以指导我,这样我就可以学习精通c
- vue.js - Vuetify 导航覆盖
- flutter - 颤振内容详细信息
- rest - 租户安全分数 - 平均比较分数数据在 Graph API 中不可用
- ruby-on-rails - Pagey gem 不返回最后一页记录
- python-3.x - 有没有办法在 PipFile 中定义本地源
- r - 从不同的列中过滤 NA 并创建新的数据框