[英]how to center a character in a css3 div with rounded borders
Hey I hope you can help me. 嘿,我希望你能帮助我。 I am trying to center a number in a css3-div.
我正在尝试将数字放在css3-div中。 I am using this:
我正在使用这个:
border:2px solid #333333;
padding:1px;
-moz-border-radius:10px;
-webkit-border-radius:10px;
-o-border-radius:10px;
-khtml-border-radius:10px;
border-radius:10px;
background-color: #fff;
height: 25px;
width: 25px;
and it gives me this: 它给了我这个:
How do I center it also with a single-digit charachter? 如何将其与一位数字字符居中?
many thanks! 非常感谢!
Assuming that the element is also display: block;
假设该元素也
display: block;
(or display: inline-block;
) you can just add: (或
display: inline-block;
),您只需添加:
text-align: center;
line-height: 25px; /* vertical height of the container/element */
to your CSS. 到您的CSS。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.