解决方案 2月29日上午9:38,Andy Fish< ajf ... @ blueyonder.co.ukwrote: 我试图以等宽字体输出一些html,我想要空格 take与任何其他角色的宽度相同。我认为这对于等宽字体来说很容易 - 肯定& ensp;和& emsp;两者都是相同的 宽度? 遗憾的是没有 - & ensp;比其他角色和& emsp更窄; 更宽:-( 所以我如何生成一系列正常宽度的空格? 我不能使用< pretag,因为有HTML标记在输出中 - 它是 不仅纯文本 Andy 也许& nbsp; Andy Fish写道: 我不能使用< pretag因为输出中有HTML标记 - 它不仅是纯文本 您可以在< pre>中使用标记。 - Toby A Inkster BSc(荣誉)ARCS [极客HTML / SQL / Perl / PHP / Python / Apache / Linux] [操作系统:Linux 2.6.17.14-mm-desktop-9mdvsmp,上升30天,22:37。] 瓶装水 http://tobyinkster.co .uk / blog / 2008/02/18 /瓶装水/ 2008年2月29日星期五,Andy Fish写道: 我试图以等宽字体输出一些html,我想要空格 占用与任何其他字符相同的宽度。我认为这对于等宽字体来说很容易 - 肯定是& ensp;和& emsp;两者都是一样的 宽度? 有些东西在等宽字体中毫无意义。想想所有具有零宽度的 字符。在他们的名字。 遗憾的是没有 - & ensp;比其他角色和& emsp更窄; 更宽:-( In * which * font? 浏览器也可以从其他字体中获取ensp和emsp 。 - In memoriam Alan J. Flavell http ://groups.google.com/groups/sear...Alan.J.Flavell Hi,I am trying to output some html in monospaced font, and I want spaces totake up the same width as any other character. i thought this would be easyfor monospaced fonts - surely   and   would both be the samewidth?unfortunately not -   is narrower than other characters and   iswider :-(so how do i generate a sequence of normal width spaces?I can''t use the <pretag because there is HTML markup in the output - it''snot only plain textAndy 解决方案 On Feb 29, 9:38 am, "Andy Fish" <[email protected]:Hi,I am trying to output some html in monospaced font, and I want spaces totake up the same width as any other character. i thought this would be easyfor monospaced fonts - surely   and   would both be the samewidth?unfortunately not -   is narrower than other characters and   iswider :-(so how do i generate a sequence of normal width spaces?I can''t use the <pretag because there is HTML markup in the output - it''snot only plain textAndymaybe Andy Fish wrote:I can''t use the <pretag because there is HTML markup in the output -it''s not only plain textYou can use markup within <pre>.--Toby A Inkster BSc (Hons) ARCS[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux][OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 30 days, 22:37.]Bottled Water http://tobyinkster.co.uk/blog/2008/02/18/bottled-water/On Fri, 29 Feb 2008, Andy Fish wrote:I am trying to output some html in monospaced font, and I want spaces totake up the same width as any other character. i thought this would be easyfor monospaced fonts - surely   and   would both be the samewidth?Some things are meaningless in monospaced fonts. Think of all thecharacters that have "zero-width" in their names.unfortunately not -   is narrower than other characters and  is wider :-(In *which* font?It is also possible that the browser takes ensp and emspfrom some other font.--In memoriam Alan J. Flavell http://groups.google.com/groups/sear...Alan.J.Flavell 这篇关于& ensp采用等宽字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-23 11:03