css实现:不固定宽高,随内容宽度自动增长的圆形

 

1
.circle { display: inline-block; border-radius: 50%; min-width: 20px; min-height: 20px; padding: 5px; background: red; color: white; text-align: center; line-height: 1; box-sizing: content-box; white-space: nowrap; } .circle::before { content: ""; display: inline-block; vertical-align: middle; padding-top: 100%; height: 0; } .circle span { display: inline-block; vertical-align: middle; }

你可能感兴趣的:(css,前端,javascript)