我认为这就是你要找的 – > (查看后面的片段)
>如果要移动A,D并在它们之间创建空格,最好的选择是使用flexBox属性.>链接A,D未正确显示,因为您使用位置:固定在li标签上,将它们全部放在同一个小空间中.>如果要将链接放在圆圈内,只需在A标记中添加边框和边框半径即可.> [EDIT]显示:锚标签上的flex是设置A,D字母 完美地在圆圈的中心.我认为这种方法更多 比别人更可靠实现它.> [编辑]如果您想移动整个列表而不是在左侧移动,请记住您只需将display:flex应用于.navig类并使用justify-content和align-items属性.
CCS和HTML(HTML保持不变)
.navig li {
list-style-type: none;
margin: 30px 0;
}
.navig a {
display: flex;
justify-content: center; /*flex property to center horizontally*/
align-items: center; /*flex property to center vertically*/
width: 50px;
height: 50px;
border: 1px solid black;
border-radius: 50%;
text-decoration: none;
color: black;
}
ul,li,a {
margin: 0;
padding: 0;
}
|