且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在文本下创建一个点/小圆圈?

更新时间:2023-02-09 20:36:16

可以使用转换后的伪元素来创建它:

A transformed pseudo element can be used to create this:

body { text-align: center; }

.text {
  display: inline-block;
  vertical-align: top;
  padding-bottom: 10px;
  position: relative;
  text-align: center;
  padding: 20px 10px;
  line-height: 24px;
  min-width: 100px;
  background: #333;
  font-size: 20px;
  color: #fff;
}

.text::before {
  transform: translateX(-50%);
  border-radius: 100%;
  position: absolute;
  background: blue;
  bottom: 10px;
  height: 8px;
  content: '';
  width: 8px;
  left: 50%;
}

<div class="text">about</div>