我想有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*/
}
Run Code Online (Sandbox Code Playgroud)
<ul>
<li>A</li>
<li>B</li>
<li>C</li>
<li>D</li>
</ul>
Run Code Online (Sandbox Code Playgroud)