如果您想在CSS下边框中间添加一个点,可以使用以下代码进行实现:border-bottom: 1px solid #000; position: relative; 使用“position: rela
如果您想在CSS下边框中间添加一个点,可以使用以下代码进行实现:
border-bottom: 1px solid #000; position: relative;
使用“position: relative;”是为了让下边框上方的点相对于下边框进行定位:
border-bottom: 1px solid #000; position: relative; &:after { content: ""; width: 6px; height: 6px; background: #000; position: absolute; bottom: -3px; left: 50%; transform: translateX(-50%); border-radius: 50%; }
在上面的代码中,“&:after”表示在下边框后面添加伪元素。在伪元素中,使用“position: absolute;”将点相对于下边框进行定位,并且“bottom: -3px;”将它定位在下边框的中心。
“left: 50%;”将点水平居中,而“transform: translateX(-50%);”则将点沿着水平方向向左移动半个点的宽度,从而让点垂直居中。
最后,“border-radius: 50%;”将点变成圆形。
粉丝
0
关注
0
收藏
0