473,405 Members | 2,300 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,405 software developers and data experts.

Confused about styling KBD and SAMP (author-user conflict)

I want these to be in monospace, but monospace fonts are typically
bigger looking than proportional fonts so I want to reduce the font
size a bit. This leads me as an author to write

kbd, samp { font-family: monospace; font-size: 90% }

But _because_ monospace fonts are typically too big, as a user
browsing other authors' Web pages I've told Mozilla to render
monospace as 15px (compared to 17px for serif and sans).

Here's the conflict: Mozilla seems to apply that 90% not to the
font-size of the enclosing <p> but rather to the 15px user
specification. So I end up with monospace text that is too small.
But if I don't assign a font size, then users who never set their
monospace size see monospace that is too big.

What's wrong in my thinking here? Please understand that I'm not
asking a Mozilla question; I just mentioned Mozilla as an
illustration of what one browser does. My question is how I, as an
author, should style KBD and SAMP so that the size of monospace
looks about right, namely ust a bit less tall than the surrounding
normal text.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Jul 21 '05 #1
6 1837
On Tue, 19 Oct 2004 08:02:44 -0400, Stan Brown
<th************@fastmail.fm> wrote:
I want these to be in monospace, but monospace fonts are typically
bigger looking than proportional fonts so I want to reduce the font
size a bit. This leads me as an author to write

kbd, samp { font-family: monospace; font-size: 90% }

But _because_ monospace fonts are typically too big, as a user
browsing other authors' Web pages I've told Mozilla to render
monospace as 15px (compared to 17px for serif and sans).

Here's the conflict: Mozilla seems to apply that 90% not to the
font-size of the enclosing <p> but rather to the 15px user
specification. So I end up with monospace text that is too small.
But if I don't assign a font size, then users who never set their
monospace size see monospace that is too big.
IIANM, *all* browsers set a slightly smaller default size for monospaced
fonts. So if you do nothing to the paragraph font size, it should work.
And I assume all browsers will scale the monospaced font up and down when
the container has a different font-size, but I haven't tested that.
What's wrong in my thinking here? Please understand that I'm not
asking a Mozilla question; I just mentioned Mozilla as an
illustration of what one browser does. My question is how I, as an
author, should style KBD and SAMP so that the size of monospace
looks about right, namely ust a bit less tall than the surrounding
normal text.


--
Rijk van Geijtenbeek

The Web is a procrastination apparatus:
It can absorb as much time as is required to ensure that you
won't get any real work done. - J.Nielsen

Jul 21 '05 #2
Stan Brown wrote:
Here's the conflict: Mozilla seems to apply that 90% not to the
font-size of the enclosing <p> but rather to the 15px user
specification. So I end up with monospace text that is too small.
But if I don't assign a font size, then users who never set their
monospace size see monospace that is too big.


Not necessarily. My browser uses a mixture of Lucida Sans, Lucida Bright and
Lucida Sans Typewriter fonts that all have more or less identical x-heights.
I'd appreciate it if you could just leave them as they are.

And presumably there are other people besides yourself who have set up
Mozilla to use a smaller point size for monospace text.

I think it would be safer to leave the choice of font sizes up to your
visitors. I imagine that most of the people who would be bothered by the
sort of problem you mentioned will already have found their own solution.

Phil

--
Philip Ronan
ph***********@virgin.net
(Please remove the "z"s if replying by email)
Jul 21 '05 #3
"Rijk van Geijtenbeek" <ri**@operaremovethiz.com> wrote in
comp.infosystems.www.authoring.stylesheets:
And I assume all browsers will scale the monospaced font up and down when
the container has a different font-size, but I haven't tested that.


I thought I had tested it, but I've now done some additional testing
and I think I was wrong before.

This time around I used some really extreme values, like
p { font-size: 300% }
to help me see what's going on. Yes, my Mozilla (1.7 on Win98) does
scale the monospaced font to match the containing paragraph. The
author style sheet does seem to be honored over the "15 px" in the
Mozilla preferences.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Jul 21 '05 #4
"Philip Ronan" <ph***********@virgin.net> wrote in
comp.infosystems.www.authoring.stylesheets:
Stan Brown wrote:
Here's the conflict: Mozilla seems to apply that 90% not to the
font-size of the enclosing <p> but rather to the 15px user
specification. So I end up with monospace text that is too small.
But if I don't assign a font size, then users who never set their
monospace size see monospace that is too big.


Not necessarily. My browser uses a mixture of Lucida Sans, Lucida Bright and
Lucida Sans Typewriter fonts that all have more or less identical x-heights.
I'd appreciate it if you could just leave them as they are.


Fair enough.

As I mentioned in response to Rijk's note, I was somehow working
from a false premise. On further testing it does appear that I was
wrong and Mozilla uses the style sheet rather than that pixel size
set in Edit>>Preferences. Specifically, if I try styling <p> as 300%
size then the enclosed monospace gets bigger too.

Therefore I guess there's no need for any font-size in my style
sheet for KBD and SAMP, not even 100%.

Thanks to you both for responding.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Jul 21 '05 #5
Stan Brown wrote:
This time around I used some really extreme values, like
p { font-size: 300% }
to help me see what's going on. Yes, my Mozilla (1.7 on Win98) does
scale the monospaced font to match the containing paragraph. The
author style sheet does seem to be honored over the "15 px" in the
Mozilla preferences.


Unless I've misunderstood you, the 15px you set in prefs is the size of
monospaced fonts where font-size is 100%. If you change that (e.g. in an
author stylesheet), the font size changes with it. This is no different
then serif or sans font sizes in Moz prefs: the size you set as user is
the size of text where the author has not set a font-size (or set it to
100%).

--
Brian (remove "invalid" to email me)
Jul 21 '05 #6
Stan Brown wrote:
I want these to be in monospace, but monospace fonts are typically
bigger looking than proportional fonts so I want to reduce the font
size a bit. This leads me as an author to write

kbd, samp { font-family: monospace; font-size: 90% }

But _because_ monospace fonts are typically too big, as a user
browsing other authors' Web pages I've told Mozilla to render
monospace as 15px (compared to 17px for serif and sans).
I think all browsers set monospaced fonts smaller than proportional
fonts by default. In fact, I find monspaced font size too small as
configured out of the box.
What's wrong in my thinking here?
You're treating monospaced differently than proportional.
My question is how I, as an author, should style KBD and SAMP so that
the size of monospace looks about right, namely ust a bit less tall
than the surrounding normal text.


I wouldn't style it at all, or rather, I would not style it smaller. The
rules for main body font applies to monospaced, too. FWIW, I've styled
KBD to be a bit bigger on one page I authored to be sure that visitors
could view it.

--
Brian (remove "invalid" to email me)
Jul 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Peter Collinson | last post by:
Hi... Is there any way to style a List Item a different color and size than the <LI> in an Ordered List? I'd like a red super-script number and a dark blue text in a page's footnotes. And...
3
by: C CORDON | last post by:
I am verry confused about classes. I understand that classes can encapsulate properties, methods, events (don't know hoy to add events to a class), etc. I am confused with this: if you can...
10
by: Xiaoshen Li | last post by:
Dear All, I am confused with prototypes in C. I saw the following code in a C book: void init_array_1(int data) { /* some code here */ }
2
by: wavedancer | last post by:
I am confused about the syntax used in the style sheet that accompanies the website I've inherited and have been asked to tidy up. XHTML is new to me, and I've only used CSS for font and link styles...
1
by: mick | last post by:
Hi, if I add a record to a table in my database, everything goes well. When I then place the table in another database and link to it from my database I suddenly get a key conflict when I add a...
3
by: Momomo | last post by:
Hi, I am having a problem with a control which is caused by a style on the page which I am not able to trace. If I use the control in a page without any styling it looks ok. Is there a way to...
14
lotus18
by: lotus18 | last post by:
Hello all I have these records on my Day Table for my complete database table please click here 1. M 2. T 3. W 4. TH 5. F 6. S
40
by: Jukka K. Korpela | last post by:
My basic style sheet has a distinctive background and border for forms, to make the structure clearer and to make it visually evident what belongs to a form. However, as people complained that...
10
by: JD | last post by:
I've seen websites where the link underline is a different colour to the link text. I've also seen links with dotted underlines (see the hover effect on the 'Change' and 'All Microsoft Sites' links...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.