
使用JavaScript的fixed()方法以固定间距字体显示,就像在标签中一样。
示例
您可以尝试运行以下命令以固定间距字体显示字符串的代码。
1 2 3 4 5 6 7 8 9 10 11 12 | <html>
<head>
<title>JavaScript String fixed() Method</title>
</head>
<body>
<script>
var str = new String( "Hello world" );
alert(str.fixed());
</script>
</body>
</html>
|
登录后复制
以上是如何在等宽字体中显示字符串?的详细内容。更多信息请关注PHP中文网其他相关文章!