Force Non-Monospace Font into Fixed Width Using CSS

前端 未结 8 1944
心在旅途
心在旅途 2020-11-29 04:08

Is there any way to force a font to be monospaced using CSS?

By this I mean, using a non-monospace font, can you force the browser to render each character at a fixe

8条回答
  •  离开以前
    2020-11-29 04:11

    I've just found the text-transform: full-width; experimental keyword, which:

    [...] forces the writing of a character [...] inside a square [...]

    text-transform | MDN

    Combined with negative letter-spacing, you can get not-so-horrible results:

    
    
    
    
    . i I 1  | This is gonna be awesome.
    ASDFGHJK | This is gonna be awesome.
    
    . i I 1 | This is gonna be awesome.
    ASDFGHJK | This is gonna be awesome.

提交回复
热议问题