我想创建一个完美的方形背景,在文本CH周围填充1px。 我试过这个小提琴https://jsfiddle.net/q2y0gsds/1/
.credit {
font-size:8px;
font-weight:bold;
letter-spacing:0px;
background:black;
color:white;
}
<center>
<div class="credit">CH</div>
</center>
答案 0 :(得分:0)
您应该为您的div设置width
和height
.credit {
font-size:8px;
font-weight:bold;
letter-spacing:0px;
background:black;
color:white;
height: 50px;
width: 50px;
line-height: 50px;
}
<center>
<div class="credit">CH</div>
</center>