如何在等宽字体中显示字符串?

原创
ithorizon 5个月前 (10-19) 阅读数 58 #HTML

使用JavaScript的fixed()方法以固定间距字体显示,就像在标签中一样。

示例

您可以尝试运行以下命令以固定间距字体显示字符串的代码。

<html>
   <head>
      <title>JavaScript String fixed() Method</title>
   </head>

   <body>
      <script>
         var str = new String("Hello world");
         alert(str.fixed());
      </script>
   </body>
</html>

以上就是如何在等宽字体中显示字符串?的详细内容,更多请关注IT视界其它相关文章!



热门