Making every character on a web page the same width

前端 未结 7 1315
面向向阳花
面向向阳花 2020-12-05 17:43

Is there a font or CSS property that would give every character the same width without the need of drawing them yourself(.ttf)?

7条回答
  •  遥遥无期
    2020-12-05 17:58

    For certain cases, using the pre tag,(

    text
    ), might fill your needs for monospaced (fixed width) text. It worked for me with HTML5 + Chrome (current version). The ttelement is deprecated.

    However it appears the

     tag can only contain tags which are considered "phrasing content". See "Content model" section on the w3 documentation for that tag. You can click the link to see what elements are considered "phrasing content". Of course, each browser may support a looser version of the spec if you don't care about valid HTML or cross browser compatibility.

提交回复
热议问题