为了账号安全,请及时绑定邮箱和手机立即绑定

中、右对齐挠性盒元件

中、右对齐挠性盒元件

动漫人物 2019-05-30 13:14:50
中、右对齐挠性盒元件我想要A B和C中间对齐。我怎么才能D完全向右走?之前:enter image description here之后:enter image description here做这件事的最佳做法是什么?ul {  padding: 0;  margin: 0;  display: flex;  flex-direction: row;  justify-content: center;  align-items: center;}li {  display: flex;  margin: 1px;  padding: 5px;  background: #aaa;}li:last-child {  background: #ddd;  /* magic to throw to the right*/}<ul>  <li>A</li>  <li>B</li>  <li>C</li>  <li>D</li></ul>https://jsfiddle.net/z44p7bsx/
查看完整描述

4 回答

?
FFIVE

TA贡献1797条经验 获得超6个赞

可以稍微更改接受的答案,因为您可以使用网格模板区域,并且可以不使用假元素。

grid-template-areas '. b c'grid-template-columns: 1fr 1fr 1fr


查看完整回答
反对 回复 2019-05-30
  • 4 回答
  • 0 关注
  • 661 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信