【发布时间】:2018-06-06 17:26:12
【问题描述】:
我有section,其中包含水平ul,其中包含四个li,
如下:
#header-strip ul {
display: flex;
justify-content: space-between;
margin: 0;
padding: 0;
height: 4vh;
width: 100%;
background-color: grey;
list-style-type: none;
}
#header-strip li {
display: inline;
}
<section id="header-strip">
<ul>
<li>meant to be left</li
><li>meant to be centered</li
><li>meant to be just before last</li
><li>meant to be right</li
>
</ul>
</section>
要求:
- 左边的第一项与屏幕边缘的一些小百分比偏移
- 第二个项目居中
- 第三个项目在右边,到第四个之间有一些百分比空间
- 右侧第四项,与屏幕边缘的百分比偏移
我可以用基本的justify-content: space-between; 定位li,但不知道如何以自定义方式定位它。
应该是这样的:
【问题讨论】: