<预>和比例与固定宽度的字体 [英] <pre> and proportional vs fixed width fonts

查看:91
本文介绍了<预>和比例与固定宽度的字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用< pre>标记了歌词。标记,因为它似乎是最合适的数据类型的标记类型。由于UA的默认呈现

< pre>,这导致水平空间的低效使用。固定宽度字体。


要改变它我必须指定一个比例字体系列,从而

陷入相关的大小陷阱与任何类型的作者

指定字体系列:


a)如果我指定sans serif字体,那么字体大小将是
对于将serif作为默认字体的人来说,
很大。

b)如果我指定一个serif字体,那么字体大小将会很小

谁有sans-serif作为他们的默认字体。


我想做的是指定UA'/用户'的首选
$ b应该使用$ b比例字体,但当然这是不可能的。


我是否认为这是一个无法解决的难题?

无头


-

电子邮件和usenet过滤列表: http://www.headless.dna.ie/usenet.htm

I''ve marked up song lyrics with the <pre> tag because it seems the most
appropriate type of markup for the type of data. This results in
inefficient use of horizontal space due to UA''s default rendering of
<pre> in a fixed width font.

To change that I''d have to specify a proportional font family, thereby
falling into the size pitfall that is associated with any sort of author
specified font family:

a) If I specify a sans serif font then the font size is going to be to
large for people who have serif as their default font.
b) If I specify a serif font then the font size is going to be to small
for people who have sans-serif as their default font.

What I''d like to do is specify that the UA''s/user''s preferred
proportional font should be used, but of course this isn''t possible.

Am I correct that this is an un resolvable dilemma?
Headless

--
Email and usenet filter list: http://www.headless.dna.ie/usenet.htm

推荐答案

无头< me@privacy.net>写道:
Headless <me@privacy.net> writes:
我用< pre>标记了歌词。标签,因为它似乎是最好的

a)如果我指定一个无衬线字体,那么字体大小对于将衬线作为其默认字体的人来说将是大的。
b)如果我指定一个serif字体,那么对于那些将sans-serif作为默认字体的人来说,字体大小将会很小。


指定sans-serif并假设人们会抱怨太少太多了b / b
而不是太小?

我会喜欢做的是指定应该使用UA'/用户'的首选
比例字体,但当然这是不可能的。

我是否正确是一个无法解决的难题?
I''ve marked up song lyrics with the <pre> tag because it seems the most

a) If I specify a sans serif font then the font size is going to be to
large for people who have serif as their default font.
b) If I specify a serif font then the font size is going to be to small
for people who have sans-serif as their default font.
Specify sans-serif and assume people will complain less about too big
than too small?
What I''d like to do is specify that the UA''s/user''s preferred
proportional font should be used, but of course this isn''t possible.

Am I correct that this is an un resolvable dilemma?




pre {font-family:inherit; }


适用于基于Gecko的浏览器,但不适用于Opera 7或IE6。从我的

读取规范我认为*应该*在一般的无错误的

浏览器中工作。


- -

Chris



pre { font-family: inherit; }

Works in Gecko-based browsers, not in Opera 7 or IE6, though. From my
reading of the spec I think it *should* work in a general bug-free
browser.

--
Chris


文章< 7r ******************** ************@4ax.com>在

comp.infosystems。 www.authoring.stylesheets ,无头

< me@privacy.net>写道:
In article <7r********************************@4ax.com> in
comp.infosystems.www.authoring.stylesheets, Headless
<me@privacy.net> wrote:
我用< pre>标记了歌词。标签,因为它似乎是最合适的数据类型标记类型。
I''ve marked up song lyrics with the <pre> tag because it seems the most
appropriate type of markup for the type of data.




如下所示,它并不是最合适的因为

它强制使用等宽字体。


而不是重新定义< pre>在风格方面,为什么不只是创造风格来实现你想要的?这样的事情(未经测试,但类似于我的

拥有的悬挂类)应该足够了:


p.lyric {margin-left:5em; text-indent:-4em}


这会创建一个悬挂缩进。如果窗口宽度是这样的,每一节都适合一行,那么在视觉上看起来就像歌词

都有1 em左边距。但是,如果任何一节经文超过一行,那么额外的行将缩进4 ems。


-

Stan Brown,Oak Road Systems,Cortland County,New York,USA
http:// OakRoadSystems。 com /

HTML 4.01规范: http ://www.w3.org/TR/html401/

验证器: http://validator.w3.org/

CSS 2规范: http://www.w3.org/TR/REC-CSS2/

验证器: http://jigsaw.w3.org/css-validator/



As you observe below, it''s not really the most appropriate because
it forces a monospace font.

Rather than redefine <pre> in styles, why not just create styles to
do what you want? Something like this (untested, but similar to my
own "hanging" class) should suffice:

p.lyric { margin-left: 5em; text-indent: -4em }

This creates a hanging indent. If the window width is such that
every verse fits in one line, visually it will look like the lyrics
all have a 1 em left margin. But if any verse runs to more than one
line, the extra lines will be indented by 4 ems.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
validator: http://jigsaw.w3.org/css-validator/


在文章< 87 ************ @ dinopsis.dur.ac.uk>,

Chris Morris< c。** ******@durham.ac.uk>写道:
In article <87************@dinopsis.dur.ac.uk>,
Chris Morris <c.********@durham.ac.uk> wrote:
pre {font-family:inherit; }

适用于基于Gecko的浏览器,而不是Opera 7或IE6。从我的
阅读规范我认为*应该*在一般的无bug浏览器中工作。
pre { font-family: inherit; }

Works in Gecko-based browsers, not in Opera 7 or IE6, though. From my
reading of the spec I think it *should* work in a general bug-free
browser.




pre {font-size :100%; }


使其成为父元素字体大小的100%。如果我不是b $ b缺少某些东西,那对我来说就像继承一样,并且支持罚款




-

Kris
kr ******* @ xs4all。 neth erlands(nl)

我们称他为Tortoise,因为他教我们模拟海龟说。



pre { font-size: 100%; }

Makes it 100 % of the font-size of the parent element. If I am not
missing something, that seems to me the same as ''inherit'' and it is
supported fine.

--
Kris
kr*******@xs4all.netherlands (nl)
"We called him Tortoise because he taught us" said the Mock Turtle.


这篇关于&LT;预&GT;和比例与固定宽度的字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆