简体   繁体   English

在一定数量的字符后添加空格(例如字母间距)

[英]Add space (like letter spacing) after some amount of characters

Given an Input field 给定输入字段

<input type="text" />

Type in somer Numbers 000000000000 输入一些数字000000000000

Now the desired result is: 000 000 000 000 现在所需的结果是:000000000000000

There is no way to do this right now in CSS is there? CSS现在没有办法做到这一点吗?

With pure CSS it is not possible. 使用纯CSS是不可能的。 However if you are using PHP or Javascript then you can have it. 但是,如果您使用的是PHP或Javascript,则可以使用它。 Like for example in PHP you can try like this: 例如在PHP中,您可以这样尝试:

<?php

$str = "000000000000";
echo chunk_split($str, 3, ' ');

DEMO 演示

On a side note: 附带说明:

You can also check about letter-spacing which is used to give space after every character in CSS. 您还可以检查字母间距 ,该间距用于在CSS中的每个字符之后提供空格。

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

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