Forcing HTML textarea to use a monospace font using CSS

前端 未结 4 1628
粉色の甜心
粉色の甜心 2020-12-14 05:28

How can I make my text area use a monospaced font?

4条回答
  •  我在风中等你
    2020-12-14 06:12

    Just use a monospace font. For example for something like:

    
    

    the css would be:

    #mytextarea {
        font-family: monospace;
    }
    

    If you want to use a specific monospace font, you can but don't forget adding the generic 'monospace' at the end in case the user does not have your preferred font installed:

    #mytextarea {
        font-family: 'DejaVu Sans Mono', monospace;
    }
    

提交回复
热议问题