How to display string in monospaced font?

王林
Release: 2023-09-16 12:25:06
forward
1159 people have browsed it

How to display string in monospaced font?

Use JavaScript's fixed() method to display in a fixed-spacing font, just like in the tag.

Example

You can try running the following code to display a string in a fixed-spacing font.

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

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

The above is the detailed content of How to display string in monospaced font?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template