更新时间:2023-10-25 22:10:22
您必须使用等宽字体(也称为打字机字体)。这是一种所有字符占用相同空格的字体。
You must use a monospace font (also known as typewriter font). That is a font in which all the characters take the same space.
在CSS中,字体名称 monospace
到用户系统上的默认monospace字体。将 monospace
包含在< pre>
元素的font-familly列表的结尾是个好习惯,
In CSS the font name monospace
is translated to the default monospace font on the user system. It's good practice to include monospace
at the end of a font-familly list for the <pre>
element so that it can be used as a fallback.
例如:
pre {font-family: Consolas,monospace}
将使用Consolas等宽字体到默认值。
will use the Consolas monospace font if it's available or fallback to the default.