1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > html5实现边框为圆圈 CSS怎样做出自适应圆形边框?

html5实现边框为圆圈 CSS怎样做出自适应圆形边框?

时间:2022-12-17 13:18:41

相关推荐

html5实现边框为圆圈 CSS怎样做出自适应圆形边框?

这个是不是你要的效果?根据文字长度自动变化圆的大小?

css代码.box{

display: inline-flex;

justify-content: center;

position: absolute;

}

.box1{

padding-top: calc(100% + 20px);

visibility: hidden;

min-width: 12px;

min-height: 12px;

}

.box2{

position: absolute;

padding-top: calc(100% + 20px);

width: calc(100% + 20px);

display: flex;

justify-content: center;

align-items: center;

border: 1px solid red;

border-radius: 50%;

}

.box3{

position: absolute;

text-align: center;

top: 50%;

transform: translateY(-50%);

}

html代码

2 2

这里 保持 box1 和 box3中的 文本内容一致即可。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。