By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,930 Members | 1,269 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,930 IT Pros & Developers. It's quick & easy.

<pre> tag font and size

P: n/a
I'm authoring an XML document and using the <pre> html tag for the
portions that are not dynamically generated. The <pre> text is
displaying in a smaller font size (and I believe different font) than
standard text. I would like all of my text to be formatted this way,
though I don't want to use the <pre> tag for all of it. Can anyone
tell me what font and size are used by default for the <pre> tag?

I don't want to change it's font/size; just the font/size of the rest
of the document to match.

-James

Jul 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a


Porthos wrote:

The <pre> text is
displaying in a smaller font size (and I believe different font) than
standard text. I would like all of my text to be formatted this way,
though I don't want to use the <pre> tag for all of it. Can anyone
tell me what font and size are used by default for the <pre> tag?


It will depend on the browser, its default style sheet, and can also
depend on the user stylesheet.
CSS 2.1 suggests the following default style sheet for HTML 4:
<http://www.w3.org/TR/CSS21/sample.html>
there you find the following CSS rules applying to <pre> elements:
pre { display: block }
pre, tt, code,
kbd, samp { font-family: monospace }
pre { white-space: pre }

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

P: n/a
In our last episode,
<11*********************@z14g2000cwz.googlegroups. com>,
the lovely and talented Porthos
broadcast on comp.infosystems.www.authoring.html:
I'm authoring an XML document and using the <pre> html tag for the
portions that are not dynamically generated. The <pre> text is
displaying in a smaller font size (and I believe different font) than
standard text. I would like all of my text to be formatted this way,
though I don't want to use the <pre> tag for all of it. Can anyone
tell me what font and size are used by default for the <pre> tag? I don't want to change it's font/size; just the font/size of the rest
of the document to match.


Of course this is highly browser-dependent. Typically material
in <pre> gets a monospaced font (otherwise <pre> is kind of
pointless). Many browsers assign it a size 2 pts (whatever pts
means to that browser) than the normal body type. Many users
immediately adjust this to something more readable. I suggest
you adjust your preferences in your browser and allow other
users to do the same.

--
Lars Eighner ei*****@io.com http://www.io.com/~eighner/
My mail reader can beat up your mail reader.
Jul 23 '05 #3

P: n/a
Porthos wrote:
I'm authoring an XML document and using the <pre> html tag for the
portions that are not dynamically generated. The <pre> text is
displaying in a smaller font size (and I believe different font) than
standard text. I would like all of my text to be formatted this way,
though I don't want to use the <pre> tag for all of it. Can anyone
tell me what font and size are used by default for the <pre> tag?

I don't want to change it's font/size; just the font/size of the rest
of the document to match.

-James


Set the <pre> text to the same percent size and
font family as the rest of your text. I had the
same problem (with size) in Opera and IE, if I
remember correctly, and I solved it that way.
I think the default font for <pre> is Courier. But
be aware that many (most?) people prefer a
sans-serif font on the screen.
Hope this helps.
--
Inger Helene Falch-Jacobsen
http://home.no.net/ingernet/
Jul 23 '05 #4

P: n/a
On Thu, 30 Dec 2004, Porthos wrote:
I don't want to change it's
<news:alt.possessive.its.has.no.apostrophe>
font/size; just the font/size of the rest of the document to match.


What do you mean by "match"?

It's conventional to display preformatted text in a monospace font. Do
you want to display everything else in a monospace font? If not, then
you'll need to define "match" more precisely. x-height? Average
width? Average area?

Even if you -define- it, I'm not sure how well it's going to work in
practice, given that you don't actually know whether the reader will
have the fonts that you intended. In any case, this isn't an HTML
issue, so you'd be better off in the stylesheets group.

From practical experience I find that monospace text at 100% looks
somewhat oversize, so I tend to propose a size around 90% of the base
size. Of course, I leave the base size to the reader's discretion.
Some will argue that I should leave the <pre> size to their discretion
too, and I wouldn't argue too strongly with that. But bearing in mind
that:

* normal size text is usually large enough to be reduced by one (~90%)
or even two (~ 81%) size steps and still be readable (even if with
some difficulty in the second case),

* <pre> text is not intended to be sized, since it's meant to be
displayed with a fixed pitch

- it seems to me that proposing that <pre> be displayed with a
monospaced font with size of 90% of the base size is a fairly harmless
suggestion. But that's IMHO and YMMV.
Jul 23 '05 #5

P: n/a
Thanks for all of your help. I set the font as <font face="monospace"
size="-1"> and it matches the <pre> tag as i'm seing it displayed in IE
6.

Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.