473,657 Members | 2,993 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Controlling font size accurately across browsers

I have a large commercial site to rebuild, where the design has been
produced by the pixel-counting method. It's also one of those sites
where cramming every space full of content is seen as better than a more
spread-out and usable design that uses some scrolling. Not surprisingly
it's the work of paper-based magazine designers, not web designers.

This leaves me with several conflicting requirements:

- The body text size for the "article" pages should be 1em, for
well-known usability reasons.

- The "index" pages may require pixel-based font sizing control,
because otherwise I can't constrain the text to fit in the available
space. These spaces are fixed pixel widths - they're usually the size of
a bitmap image. Additionally they're often "headline text" which means
few short words and some clunky behaviour for linewrapping.

- It must work cross-browser, including IE6 and IE/Mac
The real problem here is that IE blows the whole lot apart. With its
well-known problems of an excessive default scaling for ems to pixels, I
can produce a good implementation for the well-behaved browsers (even on
the Mac) but any IE rendering of the page only works when the user's
text size is reduced to "Smaller". This is particularly bad if I attempt
to use <h*> markup, where the differences are particularly visible.

Any suggestions ?

Are there any "CSS hack" based techniques which will let me set a
default size of 1em/100% for web browsers, then an 85% value for IE
only, hidden by some parser hack ?
(I am _not_ interested in a discussion of em vs. pixel sizing - that's a
different issue)

Sep 18 '05 #1
10 1945
Andy Dingley wrote:
I have a large commercial site to rebuild, where the design has been
produced by the pixel-counting method. It's also one of those sites
where cramming every space full of content is seen as better than a more
spread-out and usable design that uses some scrolling. Not surprisingly
it's the work of paper-based magazine designers, not web designers. The real problem here is that IE blows the whole lot apart. With its
well-known problems of an excessive default scaling for ems to pixels, I
can produce a good implementation for the well-behaved browsers (even on
the Mac) but any IE rendering of the page only works when the user's
text size is reduced to "Smaller". This is particularly bad if I attempt
to use <h*> markup, where the differences are particularly visible.

Any suggestions ?

Are there any "CSS hack" based techniques which will let me set a
default size of 1em/100% for web browsers, then an 85% value for IE
only, hidden by some parser hack ?

(I am _not_ interested in a discussion of em vs. pixel sizing - that's a
different issue)


body { font-size:85%; voice-family: "\"}\""; voice-family:inherit;
font-size:medium; }
Sep 18 '05 #2
On Sun, 18 Sep 2005 12:33:59 -0400, C A Upsdell
<""cupsdellXXX\ "@-@-@XXXupsdell.com "> wrote:
body { font-size:85%; voice-family: "\"}\""; voice-family:inherit;
font-size:medium; }


But isn't that (the Tantek Celik hack) just going to work on IE5 ? I
need to make it work on IE6
(By some bizarre logic, I don't actually need to support IE5 / PC as my
boss won't be testing for that, but he will be carefully testing the
almost unused IE5/Mac combination)
Sep 18 '05 #3
Andy Dingley wrote:
On Sun, 18 Sep 2005 12:33:59 -0400, C A Upsdell
<""cupsdellXXX\ "@-@-@XXXupsdell.com "> wrote:

body { font-size:85%; voice-family: "\"}\""; voice-family:inherit;
font-size:medium; }


But isn't that (the Tantek Celik hack) just going to work on IE5 ? I
need to make it work on IE6


Works for me with IE6. Don't know about IE7.

Sep 18 '05 #4
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBDLdt26nf wy35F3TgRAg3bAJ oCXF5Z2wyNg+XWL CIjAQrJ6N6t/QCgxHLq
/vTPJN+Kqe3BZEMm tYFZMb0=
=5FNq
-----END PGP SIGNATURE-----
Sep 18 '05 #5
Martin Geisler wrote:
Andy Dingley <di*****@codesm iths.com> writes:

On Sun, 18 Sep 2005 12:33:59 -0400, C A Upsdell
<""cupsdellXX X\"@-@-@XXXupsdell.com "> wrote:

body { font-size:85%; voice-family: "\"}\""; voice-family:inherit;
font-size:medium; }


But isn't that (the Tantek Celik hack) just going to work on IE5 ? I
need to make it work on IE6


Wouldn't it be easier to use a documented features of IE then: the
conditional comments? Like this:

<!--[if IE]>
<style type="text/css"/>
... your IE rules here ...
</style>');
<![endif]-->

I find this approach much better than relying on various parsing
errors in IE to get things right. Using a comment which will be
ignored by all browsers except IE is much cleaner.


This requires a separate stylesheet for IE. There is some advantage to
having everything in one stylesheet.

We'll have to see what IE7 does with this.
Sep 18 '05 #6
On Sun, 18 Sep 2005 17:42:53 -0400, C A Upsdell
<""cupsdellXXX\ "@-@-@XXXupsdell.com "> wrote:
Martin Geisler wrote:
Wouldn't it be easier to use a documented features of IE then: the
conditional comments? Like this:

<!--[if IE]>
<style type="text/css"/>
... your IE rules here ...
</style>');
<![endif]-->

This requires a separate stylesheet for IE.


Not necessarily - I could inline the stylesheet into the page HTML. All
the pages are auto-generated by XSLT, so this would actually be quite
easy to do (if <xsl:comment> can generate that fragment)

As a performance issue I want to avoid the number of separate documents
to be retrieved, but I can live with a few lines added to each HTML
document.
Sep 19 '05 #7
Andy Dingley wrote:
On Sun, 18 Sep 2005 17:42:53 -0400, C A Upsdell
<""cupsdellXXX\ "@-@-@XXXupsdell.com "> wrote:
Wouldn't it be easier to use a documented features of IE then: the
conditiona l comments? Like this:

<!--[if IE]>
<style type="text/css"/>
... your IE rules here ...
</style>');
<![endif]-->

This requires a separate stylesheet for IE.


Not necessarily - I could inline the stylesheet into the page HTML. All
the pages are auto-generated by XSLT, so this would actually be quite
easy to do (if <xsl:comment> can generate that fragment)

As a performance issue I want to avoid the number of separate documents
to be retrieved, but I can live with a few lines added to each HTML
document.


But this creates a maintenance problem: a change in the CSS for IE
would then require that all the pages be updated.

Another issue is that order matters with CSS: when putting CSS in a
single stylesheet, one can put the declarations in just the right order
to achieve the desired results; one cannot readily do so with multiple
stylesheets or with embedded CSS.

Sep 19 '05 #8
C A Upsdell <""cupsdellXXX\ "@-@-@XXXupsdell.com "> wrote:
<!--[if IE]>
<style type="text/css"/>
... your IE rules here ...
</style>');
<![endif]-->
- - We'll have to see what IE7 does with this.


My bet is that for some n > 6, IE version n will still recognize the
"if IE" hack, yet process CSS more by the book than IE 6 does.
Thus, if the trick relies on "known" misfeatures of IE 6, it will break
down quite often.

I have some difficulties in understanding the "/>" vs. ">" as well as the
poor lonesome apostrophe, too, but I guess they were just typos. The sad
thing is that CSS checkers probably would not catch them, since they are
inside a comment, as far as "standards" are concerned. The construct
<style type="text/css"/> may have interesting effects, and different
effects by old (SGML) HTML rules, by XML and XHTML rules, and by tagsoup
processing.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Sep 19 '05 #9
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBDLqf66nf wy35F3TgRAu3bAK Cir4vosbdwhJTb3 +4tBUs9d6ZwkACe KS19
XjeuFrMnelR2hfC QKtxaWDQ=
=vTIq
-----END PGP SIGNATURE-----
Sep 19 '05 #10

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

Similar topics

55
4980
by: Haines Brown | last post by:
I've been setting font-size 1em; as the default in my style sheets. Until now, that seemed to be ok. But now I'm beginning to wonder. My aim is to have an easily readable, but not overly large text when the user uses the default font size in his browser and uses the typical display resolution. I did a reinstall of my friendly browser in a different environment, and I am surprised to find that its default for serif is Times 16 and
21
2863
by: James Moe | last post by:
Hello, I just joined this group and saw the discussion "What do you think of resizing 1em to 10px?" I am somewhat confused by what y'all think should be used as a reference size. I was surprised that someone actually suggested ems as a reference. Ems are relative to a selected point size, the width in points of a capital M. If no point size is given, what size does an em become? The browser obviously must decide. Also setting the body...
4
3657
by: Michel Joly de Lotbiniere | last post by:
I hope this is the correct newsgroup for this subject. The other day I came across a site www.safesquid.com that specified font-family:Terminal font-size:9pt in the inline css for command-line displays in the page content. On my Windows 2000 PC, Terminal is a bit-mapped font that comes in various fixed sizes. The rendering differences between Mozilla 1.7.2 (which is my default browser) and MS IE 6 (latest patches) are fully illustrated...
60
4757
by: deko | last post by:
As I understand it, most browser manufacturers have agreed on 16px for their default font size. So, this should be an accurate conversion for percentages: px % 16 = 100 14 = 87.5 13 = 81.25
16
2450
by: maya | last post by:
I have heard so much preaching here about how font sizes should be set as percentages so users can change font-sizes on their browsers... ok, so now at work am working on a site where we need to do precisely that b/c it's for an audience that some users maybe be visually-impaired.. but I can't get it to work right, problem is that font sizes are not consistent across diff elements.. code: body {text-align:center; /* to center...
2
4636
by: Hymer | last post by:
Hello, I have a footer at the end of each article in my blog at http://www.usernomics.com/news/user-interface-design-news.html . The footer looks perfect in IE but has smaller text in Firefox and Opera. For some reason, the CSS does not seem to be controlling the font size. The CSS and HTML are below. Does anyone know how I can get the CSS to control the Firefox and Opera
71
5778
by: Mark | last post by:
Sorry if the question is a bit basic. I generally express my font sizes in pixels, originally to handle the Macintosh/Windows font size differences (though I believe that they both now treat points the same way, at least within the browser window). It has been suggested that one should use ems to allow browsers to increase or decrease the text size. However, I have never had trouble with pixels.
18
24953
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin, that IE7 does not seem to offer any way to control the font size of a text input element.
6
1961
by: Steve | last post by:
I have a div with two - three paragrahs in it. Each paragraph has its own inline style tag with its own font size setting. When I set the last paragraph's font size the font sizes for ALL of the paragraphs change. Why? How can I stop it? I.E>
0
8384
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8302
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8820
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8718
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8499
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5630
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.