473,503 Members | 3,045 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 1930
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)

iD8DBQBDLdt26nfwy35F3TgRAg3bAJoCXF5Z2wyNg+XWLCIjAQ rJ6N6t/QCgxHLq
/vTPJN+Kqe3BZEMmtYFZMb0=
=5FNq
-----END PGP SIGNATURE-----
Sep 18 '05 #5
Martin Geisler wrote:
Andy Dingley <di*****@codesmiths.com> writes:

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


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
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.


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)

iD8DBQBDLqf66nfwy35F3TgRAu3bAKCir4vosbdwhJTb3+4tBU s9d6ZwkACeKS19
XjeuFrMnelR2hfCQKtxaWDQ=
=vTIq
-----END PGP SIGNATURE-----
Sep 19 '05 #10
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBDLqvQ6nfwy35F3TgRAjDJAJkBlcVs54+bZI9cIAfvLS E9AvIAGACeJq4d
9LaDtvWnIGf+sUQqIc+YxhQ=
=eZQY
-----END PGP SIGNATURE-----
Sep 19 '05 #11

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

Similar topics

55
4935
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...
21
2843
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...
4
3651
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...
60
4704
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 =...
16
2435
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...
2
4625
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...
71
5715
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...
18
24929
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,...
6
1951
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...
0
7193
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
7067
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
7264
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
7316
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
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4992
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...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1495
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 ...
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.