10
使flexbox元素居中和右对齐
我想有A B和C中间对齐。 我怎样才能D完全右移? 之前: 后: 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> 运行代码段隐藏结果展开摘要 …