Bootstrap带圆圈的按钮,数字位于中间 [英] Bootstrap circled button for numbers at center
本文介绍了Bootstrap带圆圈的按钮,数字位于中间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试为数字添加一个圆形按钮.我能够做到,但文字(数字未居中).理想情况下,如果我具有1到15的1到15个圆形15个按钮
I am trying to add a button for numbers a round button. I am able to do it but the text(number is not centered). Ideally if i have 1 to 15 circular 15 buttons from 1 to 15
下面的代码
body {
padding: 1em;
}
<link
href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"
rel="stylesheet"
id="bootstrap-css"
>
<button type="button" class="btn btn-info btn-circle btn-lg">100</button>
上面的代码是通过链接
推荐答案
您必须包括CSS,以使 .btn-circle
具有圆角.我从您提供的链接中复制了CSS,并删除了所有填充,以使文本居中.这将导致:
You have to include the CSS for .btn-circle
to have the rounded corners. I copied the CSS from the link you provided and removed all padding so the text is centered. This will result in:
.btn-circle {
width: 30px;
height: 30px;
text-align: center;
padding: 0; // changed
font-size: 12px;
line-height: 1.428571429;
border-radius: 15px;
}
.btn-circle.btn-lg {
width: 50px;
height: 50px;
padding: 0; // changed
font-size: 18px;
line-height: 1.33;
border-radius: 25px;
}
.btn-circle.btn-xl {
width: 70px;
height: 70px;
padding: 0; // changed
font-size: 24px;
line-height: 1.33;
border-radius: 35px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<button type="button" class="btn btn-info btn-circle btn-lg">100</button>
这篇关于Bootstrap带圆圈的按钮,数字位于中间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文