现代方法 –
CSS3 Flexboxes
现在我们有CSS3 flexboxes,你不再需要诉诸技巧和解决方法,以使这项工作。幸运的是,browser support has come a long way,我们大多数人可以开始使用flexboxes。
使用justify-content:space-between – (example here):
ul {
list-style: none;
padding: 0;
margin: 0;
}
.menu {
display: flex;
justify-content: space-between;
}
使用justify-content:space-around – (example here):
ul {
list-style: none;
padding: 0;
margin: 0;
}
.menu {
display: flex;
justify-content: space-around;
}