473,406 Members | 2,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

<pre> tag font and size

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
5 24076


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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Headless | last post by:
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...
3
by: Matt Adams | last post by:
I want to move the following <PRE> defintion to a css file: <TABLE><TR><TD><PRE>sample text</PRE></TD> <TD> not predefined font</TD></TR></TABLE> should be <TABLE><TR><TD class=aaa>sample...
7
by: Alan Illeman | last post by:
How do I set several different properties for PRE in a CSS stylesheet, rather than resorting to this: <BODY> <PRE STYLE="font-family:monospace; font-size:0.95em; width:40%; border:red 2px...
2
by: Buck Turgidson | last post by:
I want to have a css with 2 PRE styles, one bold with large font, and another non-bold and smaller font. I am new to CSS (and not exactly an expert in HTML, for that matter). Is there a way to...
7
by: Rocky Moore | last post by:
I have a web site called HintsAndTips.com. On this site people post tips using a very simply webform with a multi line TextBox for inputing the tip text. This text is encode to HTML so that no...
6
by: TomB | last post by:
Hello all, On the page located at http://deimos.curious.be/~dusk/lyrics.php#gotn I have put the lyrics text inside <pre> elements so that the UA renders the linebreaks in the code. Because...
14
by: Schraalhans Keukenmeester | last post by:
I am building a default sheet for my linux-related pages. Since many linux users still rely on/prefer viewing textmode and unstyled content I try to stick to the correct html tags to pertain good...
5
by: Hendrik Maryns | last post by:
Hi, A friend complained that the border around the lower code part on http://tcl.sfs.uni-tuebingen.de/~hendrik/keyboard.shtml is too small for the content. This is because his window size is so...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.