简体   繁体   English

如何以字母间距居中文本?

[英]How to center text with letter-spacing?

I have a centered title with quite a bit of letter-spacing (90px) and the spacing applied to the last letter disturbs the symmetry of the text.我有一个居中的标题,有相当多的字母间距(90 像素),并且应用于最后一个字母的间距会扰乱文本的对称性。 How do I fix that?我该如何解决?

Try using this -尝试使用这个 -

h1{
   letter-spacing: 90px;
   text-align: center;
   margin-right: -90px;
}

You can use text-indent to rectify this您可以使用text-indent来纠正这个

 .box { letter-spacing: 60px; text-align: center; } body { background:linear-gradient(red 0 0) center/2px 100% no-repeat; }
 <div class="box">HELLO</div> <div class="box" style="text-indent:60px;">HELLO</div>

Just put on the <center></center>只需穿上<center></center>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM