Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

'em' - relative

0 views
Skip to first unread message

Jan Faerber

unread,
Nov 18, 2004, 6:29:31 AM11/18/04
to
213.47.90.101 - - [17/Nov/2004:18:32:52 +0100] "SEARCH
/\x90\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1_etc...
that is my best visitor!

To change that... a little question to improve my knowledge:

'em' is the recommended messure with css.
To use this a kind of stylesheet rail
should be provided:

Windows.css
p { font-size: 1em; }
h1 { font-size: 2em; }

Mac.css
p { font-size: 1.3em; }
h1 { font-size: 2.66em; }

<!--#if expr="(${ HTTP_USER_AGENT} = /Win/)" -->
<link rel="stylesheet" href="win_styles.css">
<!--#else -->
<link rel="stylesheet" href=" mac_styles.css ">

Does anybody prefer this solution (with php),
are there other rails aswell
or is it better to get 'smarty' on
http://smarty.php.net/ - ?

At the moment I can not provid any URI
I am just asking.


--
Jan

http://html.janfaerber.com

Steve Pugh

unread,
Nov 18, 2004, 7:08:14 AM11/18/04
to
On Thu, 18 Nov 2004 11:29:31 GMT, Jan Faerber <jancf...@hotmail.com>
wrote:

> 'em' is the recommended messure with css.

Yes, for some properties.

> To use this a kind of stylesheet rail
> should be provided:
>
> Windows.css
> p { font-size: 1em; }
> h1 { font-size: 2em; }

Due to bugs in Win IE % are better than em for font-size, but em are still
good for margins and padding.

> Mac.css
> p { font-size: 1.3em; }
> h1 { font-size: 2.66em; }

Huh? So Mac users need text set at 130% of their chosen default size? Why?

You are aware that only old Mac browsers have a factory default font size
of 12px? Modern Mac browsers use either 16px (same as most (all?) Windows
browsers) or 14px.

> <!--#if expr="(${ HTTP_USER_AGENT} = /Win/)" -->
> <link rel="stylesheet" href="win_styles.css">
> <!--#else -->
> <link rel="stylesheet" href=" mac_styles.css ">

Firstly, assuming that all browsers on a given OS are the same is stupid.
Secondly, assuming that users need text in ordinary paragraphs set larger
than 1em is stupid.

Steve

--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

Adrienne

unread,
Nov 18, 2004, 7:46:21 AM11/18/04
to
Gazing into my crystal ball I observed Jan Faerber
<jancf...@hotmail.com> writing in
news:vI%md.10500$ha....@news.chello.at:

> 213.47.90.101 - - [17/Nov/2004:18:32:52 +0100] "SEARCH
> /\x90\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1_et

> c... that is my best visitor!


>
> To change that... a little question to improve my knowledge:
>
> 'em' is the recommended messure with css.
> To use this a kind of stylesheet rail
> should be provided:
>
> Windows.css
> p { font-size: 1em; }
> h1 { font-size: 2em; }
>
> Mac.css
> p { font-size: 1.3em; }
> h1 { font-size: 2.66em; }
>
><!--#if expr="(${ HTTP_USER_AGENT} = /Win/)" -->
><link rel="stylesheet" href="win_styles.css">
><!--#else -->
><link rel="stylesheet" href=" mac_styles.css ">
>
> Does anybody prefer this solution (with php),
> are there other rails aswell
> or is it better to get 'smarty' on
> http://smarty.php.net/ - ?
>
> At the moment I can not provid any URI
> I am just asking.
>

I don't use em for font size, I use percentages, and then only for
headings/copyright statements:
h1 {font-size:140%;} #copyright {font-size:90%}
That way, the user is seeing the font at a percentage of their choosen or
default font size.

No need to do any browser sniffing either, maybe just sniff for cookies.

--
Adrienne Boswell
Please respond to the group so others can share

The Bicycling Guitarist

unread,
Nov 18, 2004, 2:34:20 PM11/18/04
to

"Jan Faerber" <jancf...@hotmail.com> wrote in message
news:vI%md.10500$ha....@news.chello.at...

> 213.47.90.101 - - [17/Nov/2004:18:32:52 +0100] "SEARCH
> /\x90\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1_etc...
> that is my best visitor!
>

'em'-relative
Everyone's heard of Auntie Em from the Wizard of Oz.

Jan Faerber

unread,
Nov 18, 2004, 2:52:47 PM11/18/04
to
Steve Pugh wrote:

>> 'em' is the recommended messure with css.
>
> Yes, for some properties.

aha, yes I read about that.

>> To use this a kind of stylesheet rail
>> should be provided:
>>
>> Windows.css
>> p { font-size: 1em; }
>> h1 { font-size: 2em; }
>
> Due to bugs in Win IE % are better than em for font-size, but em are still
> good for margins and padding.

aha, did they found those bugs after the recommendation
of the W3C? (Anyway - it is nearly the same with %.)

>> Mac.css
>> p { font-size: 1.3em; }
>> h1 { font-size: 2.66em; }
>
> Huh? So Mac users need text set at 130% of their chosen default size? Why?

[I will try to translate it:]
Because different platforms have different screen resolutions.
Win has 96 'dpi' (dots per inch) but Mac and Linux come with 72 dpi.
If the formatting is given in pt win will display the font larger than mac.

In practice this has fatal consequences: For the font-size is given
very often in pt, this leads to a 96/72 or about 1.33 (~133%) bigger
display on win than on Mac.
'Round the other way the formatting in pt on Mac will be
displayed only 72/96=0.75 (or only about 75 percent as big alike
the according windows presentation).

The solution would be only to use px because the font-size in
px will be displayed the same on any platform.
Problem: The visitor of the page can not alter the font-size on
his own (e.g. IE: View(?) -> Font-Size) if you use px.
That would be a restriction for partially sighted people.

Therefore you use relative font-size and measures in 'em' or '%' which is
much more effective and visitor friendly. Formatting by css using units
in 'em' or the specification in percent can quite be senseful whereas
the W3C recommends the use of em. This has the advantage that
the specifications are relative and the font-size is alterable
to a cerain degree. 1 em is the standard font-size of the UA.
If desired that the font will displayed bigger than the standard
font-size a designated value bigger than 1 is selected
if a smaller one shall be displayed a value smaller than 1 will be set.

The specification in percent acts similar (bigger than standard:
bigger than 100% - smaller size: smaller than 100%).
In pracitce two extern css files are created: The one optimised
for win the one optimised for Mac respectively for Linux. The formatting in
the css file for Mac has to be 33 percent bigger than in the css file for
win.

> You are aware that only old Mac browsers have a factory default font size
> of 12px? Modern Mac browsers use either 16px (same as most (all?) Windows
> browsers) or 14px.

And what is with Linux platforms?
But it reminds me of a java example of David Flanagan:
http://html.janfaerber.com/files/HardcopyWriter.java

... Here you have a workaround for Windows - a bug:

<quote>
pagesize = job.getPageDimension(); // query the page size
pagedpi = job.getPageResolution(); // query the page resolution

// Bug Workaround:
// On windows, getPageDimension() and getPageResolution don't work, so
// we've got to fake them.
if (System.getProperty("os.name").regionMatches(true,0,"windows",0,7))
{
// Use screen dpi, which is what the PrintJob tries to emulate
pagedpi = toolkit.getScreenResolution();
// Assume a 8.5" x 11" page size. A4 paper users must change this.
pagesize = new Dimension((int)(8.5 * pagedpi), 11*pagedpi);
// We also have to adjust the fontsize. It is specified in points,
// (1 point = 1/72 of an inch) but Windows measures it in pixels.
fontsize = fontsize * pagedpi / 72;
}
</quote>
It is a little bit OT but here the same:
Everybody says - 'Java is platform independent!' But you have to
be aware of such bugs or differences between different platforms.
If you say that we have now three different font sizes:
12, 14 and 16 px we even need a third css file!

>> <!--#if expr="(${ HTTP_USER_AGENT} = /Win/)" -->
>> <link rel="stylesheet" href="win_styles.css">
>> <!--#else -->
>> <link rel="stylesheet" href=" mac_styles.css ">
>
> Firstly, assuming that all browsers on a given OS are the same is stupid.
> Secondly, assuming that users need text in ordinary paragraphs set larger
> than 1em is stupid.

Then you have to get the default font size of the browser AND the screen
resolution of the OS together to decide on further actions.


--
Jan

http://html.janfaerber.com

Jan Faerber

unread,
Nov 18, 2004, 2:55:04 PM11/18/04
to
Adrienne wrote:

> Gazing into my crystal ball I observed Jan Faerber

>> 'em' is the recommended messure with css.

> I don't use em for font size, I use percentages, and then only for
> headings/copyright statements:
> h1 {font-size:140%;} #copyright {font-size:90%}

lol - yes, that is nearly the same.

--
Jan

http://html.janfaerber.com

Jan Faerber

unread,
Nov 18, 2004, 3:19:13 PM11/18/04
to
The Bicycling Guitarist wrote:

> Everyone's heard of Auntie Em from the Wizard of Oz.

And then came "Charley", "Frances", "Ivan" und "Jeanne".

--
Jan

http://html.janfaerber.com

Steve Pugh

unread,
Nov 18, 2004, 3:35:16 PM11/18/04
to
On Thu, 18 Nov 2004 19:52:47 GMT, Jan Faerber
<jancf...@hotmail.com> wrote:

>Steve Pugh wrote:
>
>>> 'em' is the recommended messure with css.
>>
>> Yes, for some properties.
>
>aha, yes I read about that.
>
>>> To use this a kind of stylesheet rail
>>> should be provided:
>>>
>>> Windows.css
>>> p { font-size: 1em; }
>>> h1 { font-size: 2em; }
>>
>> Due to bugs in Win IE % are better than em for font-size, but em are still
>> good for margins and padding.
>
>aha, did they found those bugs after the recommendation
>of the W3C? (Anyway - it is nearly the same with %.)

Look at http://steve.pugh.net/test/test47.html to see the problem.

>>> Mac.css
>>> p { font-size: 1.3em; }
>>> h1 { font-size: 2.66em; }
>>
>> Huh? So Mac users need text set at 130% of their chosen default size? Why?
>
>[I will try to translate it:]
>Because different platforms have different screen resolutions.
>Win has 96 'dpi' (dots per inch) but Mac and Linux come with 72 dpi.
>If the formatting is given in pt win will display the font larger than mac.

"If the formatting is given in pt"

Not the formatting is not given in pt. So this is irrelevant. And as I
hinted modern Mac browsers use 96dpi same as Windows browsers.

>In practice this has fatal consequences: For the font-size is given
>very often in pt, this leads to a 96/72 or about 1.33 (~133%) bigger
>display on win than on Mac.
>'Round the other way the formatting in pt on Mac will be
>displayed only 72/96=0.75 (or only about 75 percent as big alike
>the according windows presentation).

But using pt for font sizes is a bad idea anyway.

If you want to assume that all browsers have a factory default of 12pt
then old Mac browsers do use 72dpi and so the default is 12px. But
modern Mac browsers (IE5+, Gecko based browsers) use 96dpi and so the
default is 16px - exactly the same as Windows.

>In pracitce two extern css files are created: The one optimised
>for win the one optimised for Mac respectively for Linux. The formatting in
>the css file for Mac has to be 33 percent bigger than in the css file for
>win.

So Mac users get sizes 33% larger than they need. Stupid.

>>> <!--#if expr="(${ HTTP_USER_AGENT} = /Win/)" -->
>>> <link rel="stylesheet" href="win_styles.css">
>>> <!--#else -->
>>> <link rel="stylesheet" href=" mac_styles.css ">
>>
>> Firstly, assuming that all browsers on a given OS are the same is stupid.
>> Secondly, assuming that users need text in ordinary paragraphs set larger
>> than 1em is stupid.
>
>Then you have to get the default font size of the browser

No you don't.
You know that the user can read the default font size in their browser
and that's all you need to know.

>AND the screen resolution of the OS together to decide on further actions.

Totally irrelevant.

The 'font resolution' only comes into play if you size the text in
physcal units like pt or cm - which you shouldn't do.

And the screen resolution is totally irrelevant and can vary vastly on
the same computer - my graphic card supports resolutions from 800x600
to 2048x1536 - that's a two and half times factor of difference in
resolution if I use those two settings on the same sized display.

Steve

Jan Faerber

unread,
Nov 19, 2004, 10:21:34 AM11/19/04
to
Steve Pugh wrote:

>>> Due to bugs in Win IE % are better than em for font-size, but em are
>>> still good for margins and padding.
>>
>>aha, did they found those bugs after the recommendation
>>of the W3C? (Anyway - it is nearly the same with %.)
>
> Look at http://steve.pugh.net/test/test47.html to see the problem.

I don't have IE - can I install it on Linux with wine?

Can there a screenshot be added?

>>[I will try to translate it:]
>>Because different platforms have different screen resolutions.
>>Win has 96 'dpi' (dots per inch) but Mac and Linux come with 72 dpi.
>>If the formatting is given in pt win will display the font larger than
>>mac.
>
> "If the formatting is given in pt"
>
> Not the formatting is not given in pt. So this is irrelevant. And as I
> hinted modern Mac browsers use 96dpi same as Windows browsers.

I just tried to translate this:
http://www.exine.de/webdesign/win_mac.htm

>>In practice this has fatal consequences: For the font-size is given
>>very often in pt, this leads to a 96/72 or about 1.33 (~133%) bigger
>>display on win than on Mac.
>>'Round the other way the formatting in pt on Mac will be
>>displayed only 72/96=0.75 (or only about 75 percent as big alike
>>the according windows presentation).
>
> But using pt for font sizes is a bad idea anyway.
>
> If you want to assume that all browsers have a factory default of 12pt
> then old Mac browsers do use 72dpi and so the default is 12px. But
> modern Mac browsers (IE5+, Gecko based browsers) use 96dpi and so the
> default is 16px - exactly the same as Windows.

"default is 12px" ... px is not pt ... px is the same with 72 and 96dpi.
If you use px the font size is the same.
I can not find a date here of this article.
But it seems as if "using pt for font sizes is a bad idea anyway"
has something to do with this problem that the font is getting
very small on Mac and Linux for instance.

>>In pracitce two extern css files are created: The one optimised
>>for win the one optimised for Mac respectively for Linux. The formatting
>>in the css file for Mac has to be 33 percent bigger than in the css file
>>for win.
>
> So Mac users get sizes 33% larger than they need. Stupid.

Was it stupid with old macs aswell?


>>>> <!--#if expr="(${ HTTP_USER_AGENT} = /Win/)" -->
>>>> <link rel="stylesheet" href="win_styles.css">
>>>> <!--#else -->
>>>> <link rel="stylesheet" href=" mac_styles.css ">
>>>
>>> Firstly, assuming that all browsers on a given OS are the same is
>>> stupid. Secondly, assuming that users need text in ordinary paragraphs
>>> set larger than 1em is stupid.
>>
>>Then you have to get the default font size of the browser
>
> No you don't.
> You know that the user can read the default font size in their browser
> and that's all you need to know.

... and in some browsers this will be too small.
But thank you for the hint that mac is now coming with 96dpi!
I did not know that - thank you again!

>>AND the screen resolution of the OS together to decide on further actions.
>
> Totally irrelevant.
>
> The 'font resolution' only comes into play if you size the text in
> physcal units like pt or cm - which you shouldn't do.

So you have now em and percent and everything starts from the beginning.

> And the screen resolution is totally irrelevant and can vary vastly on
> the same computer - my graphic card supports resolutions from 800x600
> to 2048x1536 - that's a two and half times factor of difference in
> resolution if I use those two settings on the same sized display.

To get the screen resolution can be useful:

www.ba-ca.com/js/common_lib.js
<quote>
//--- get screen resolution ---
if(nBrowser >= 4)
{
nScreenWidth = screen.width;
nScreenHeight = screen.height;

//--- center on screen if higher than 800x600 ---
if(nScreenWidth > 820)
nLeft = (nScreenWidth - nWidth) / 2;

if(nScreenHeight > 620)
nTop = (nScreenHeight - nHeight) / 2;
}
</quote>

Why not using it in this context aswell?

--
Jan

http://html.janfaerber.com

Steve Pugh

unread,
Nov 19, 2004, 10:40:09 AM11/19/04
to
On Fri, 19 Nov 2004 15:21:34 GMT, Jan Faerber <jancf...@hotmail.com>
wrote:
> Steve Pugh wrote:

>> If you want to assume that all browsers have a factory default of 12pt
>> then old Mac browsers do use 72dpi and so the default is 12px. But
>> modern Mac browsers (IE5+, Gecko based browsers) use 96dpi and so the
>> default is 16px - exactly the same as Windows.
>
> "default is 12px" ... px is not pt

Bingo. But everything displayed on a screen is displayed in pixels. So if
the font size is specified in pt then it will be converted to pixels at
some point. The original Macs were designed with desktop publishing in
mind and so 72dpi was a sensible choice at that time.

All the early graphical browsers had a default font size of 12pt, this was
a hangover from DTP and word processing software that the browser
manufacturers thought that the users would be familiar with, even if it
made very little sense for screen display.

Back then, on Macs 12pt = 12px and on Windows 12pt = 16px (or 20px of
Large Fonts are selected in Windows).

> ... px is the same with 72 and 96dpi.
> If you use px the font size is the same.

Yes, but that's got nothing to do with sizing the text in pt or em.

> But it seems as if "using pt for font sizes is a bad idea anyway"
> has something to do with this problem that the font is getting
> very small on Mac and Linux for instance.

Can you give an example of an actual site that's causing this problem and
tell us which versions of which browsers are displaying the problem?

>>> In pracitce two extern css files are created: The one optimised
>>> for win the one optimised for Mac respectively for Linux. The

>>> formatting in the css file for Mac has to be 33 percent biggerthan in

>>> the css file for win.
>>
>> So Mac users get sizes 33% larger than they need. Stupid.
>
> Was it stupid with old macs aswell?

Yes.

Even if the factory default was smaller in pixel terms (it might have been
larger in real terms depending on the screen resolution) the user could
change the default if it was too small for them to read. Assuming that the
user has browser default that is too small for them to read is very
foolish - how many users would keep using a browser where they can't read
the default text size, especially when so many sites try to force text to
be smaller than the default.

>>> Then you have to get the default font size of the browser
>>
>> No you don't.
>> You know that the user can read the default font size in their browser
>> and that's all you need to know.
>
> ... and in some browsers this will be too small.

Some browsers have a default font size for their users to read?
How many users would continue to use a browser where they couldn't read
the defaukt text size? They would change the default or change the browser.

Steve

Sybren Stuvel

unread,
Nov 19, 2004, 12:48:34 PM11/19/04
to
Jan Faerber enlightened us with:

> I don't have IE - can I install it on Linux with wine?

Yep, but not with plain wine, but with Crossover Office.

Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?

Jan Faerber

unread,
Nov 19, 2004, 2:50:55 PM11/19/04
to
Steve Pugh wrote:

.
.
.

I understand.


--
Jan

http://html.janfaerber.com

Toby Inkster

unread,
Nov 19, 2004, 3:21:00 PM11/19/04
to
Jan Faerber wrote:

> Win has 96 'dpi' (dots per inch) but Mac and Linux come with 72 dpi.

I've never seen a Linux distro that defaults to 72dpi. Most default to
75dpi, some default to 100dpi.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Jan Faerber

unread,
Nov 21, 2004, 7:20:38 AM11/21/04
to
Toby Inkster wrote:

> Jan Faerber wrote:
>
>> Win has 96 'dpi' (dots per inch) but Mac and Linux come with 72 dpi.
>
> I've never seen a Linux distro that defaults to 72dpi. Most default to
> 75dpi, some default to 100dpi.

hm - I am having a look now in (or is it at[?]) my info centre
of fedora core ...
http://html.janfaerber.com/my_dpi_resolution.php

I have 81 x 81 dpi

*gg*

So dpi has something to do

[ ] with software
[ ] with hardware
[ ] with soft- and hardware

???

--
Jan

http://html.janfaerber.com

Lauri Raittila

unread,
Nov 21, 2004, 7:55:02 AM11/21/04
to
in alt.html, Jan Faerber wrote:
> Toby Inkster wrote:
>
> > Jan Faerber wrote:
> >
> >> Win has 96 'dpi' (dots per inch) but Mac and Linux come with 72 dpi.

That is just default, and has nothing to do with reality.



> > I've never seen a Linux distro that defaults to 72dpi. Most default to
> > 75dpi, some default to 100dpi.

Most likely that was 10 years or some ago, and after that there has been
something that makes sence... IIRC, when I installed X year ago, it asked
me correct dpi someway...

> hm - I am having a look now in (or is it at[?]) my info centre
> of fedora core ...
> http://html.janfaerber.com/my_dpi_resolution.php
>
> I have 81 x 81 dpi

That is most likely correct, if you have 17" monitor running 1024*768

Hm. I have now 13.7" LCD (same as 15" CRT) with 1024*768 and 19" with
1600*1200. Both set to 96dpi. First is about right, and second isn't...

> So dpi has something to do
>
> [ ] with software

> [x] with hardware
> [ ] with soft- and hardware

But, software that defaults incorrect value like 72dpi (good for 800*600
on 15") or 96dpi, make things unpredictable, if you try to use cm, mm, pt
or inch in screen to measure something. And real difference in dpi makes
impossible to use px as unit... So em and ex are about only units that
make sence. (percentage on fonts, as it is practically same as em there)

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>

Jan Faerber

unread,
Nov 21, 2004, 8:42:16 AM11/21/04
to
Sybren Stuvel wrote:

> Jan Faerber enlightened us with:
>> I don't have IE - can I install it on Linux with wine?
>
> Yep, but not with plain wine, but with Crossover Office.
>
> Sybren

Thank you - you posted it already a second time now.
I have OpenOffice.
Is there an integrated IE similar browser in Crossover Office?
What is the name of that Office Application?


--
Jan

http://html.janfaerber.com

Sybren Stuvel

unread,
Nov 21, 2004, 9:31:14 AM11/21/04
to
Jan Faerber enlightened us with:
> Thank you - you posted it already a second time now.

I have? My server must have had a hickups.

> I have OpenOffice. Is there an integrated IE similar browser in
> Crossover Office?

Crossover Office is a fork of Wine, especially tweaked to run MS
Office, MS Internet Explorer and other Windows applications. It is
*not* an office suite.

Toby Inkster

unread,
Nov 21, 2004, 11:40:19 AM11/21/04
to
Jan Faerber wrote:

> So dpi has something to do
>
> [ ] with software
> [ ] with hardware
> [ ] with soft- and hardware

There are two "dpi"s to consider:

1. Your real dpi. This is dependent on your physical screen size and the
pixel size of your desktop. e.g. say your desktop is 800x600 and your
screen is 15" (measured diagonally), then your dpi is:

square_root(800^2 + 600^2) / 15 =~ 66.7.

2. Your configured dpi. This is the dpi your browser/operating
system/whatever *believes* to be your real dpi. This is usually set in
some "Advanced" tab of some settings screen, so is normally wrong.

When you specify any sizes in physical sizes like inches, centimetres,
points or whatever, your computer uses the configured dpi to "translate"
the measurement into pixels so that it can display them on the screen.

For example, my screen is 17" (16" viewable), 1280x1024 so has a real dpi
of about 102.4. I have configured my dpi as 102.

So for a font size of 12pt, the browser thinks 12pt is 1/6 of an inch (a
point is defined as 1/72 of an inch), which is exactly 17 pixels at 102
dpi. So a 12pt font is drawn as 17px on my screen.

Michael Fesser

unread,
Nov 21, 2004, 12:15:39 PM11/21/04
to
.oO(Jan Faerber)

>To get the screen resolution can be useful:

Why? There's absolutely no relationship between the screen resolution
and the available space (viewport) in the browser window.

>www.ba-ca.com/js/common_lib.js
><quote>
> //--- get screen resolution ---

>[...]

I run a dual-head system: One screen is currently on 1600x1200px, the
other on 1152x864px. What do you think the above function will return
for screen width and height?

Micha

Sam Hughes

unread,
Nov 21, 2004, 1:57:28 PM11/21/04
to
Michael Fesser <net...@gmx.net> wrote in
news:pti1q0l164m5s8k0d...@4ax.com:

> .oO(Jan Faerber)
>
>>To get the screen resolution can be useful:
>
> Why? There's absolutely no relationship between the screen resolution
> and the available space (viewport) in the browser window.

Well, usually one is less than the other.

If you knew that the screen resolution was say, 1400 px wide, you could use
a background image that was 1400 px wide and be confident it wouldn't
repeat horizontally.

Not that trying to do that would be a good idea -- but a relationship does
exist.

Michael Fesser

unread,
Nov 21, 2004, 2:59:12 PM11/21/04
to
.oO(Sam Hughes)

>Michael Fesser <net...@gmx.net> wrote


>
>> Why? There's absolutely no relationship between the screen resolution
>> and the available space (viewport) in the browser window.
>
>Well, usually one is less than the other.

Yep, but you can't be sure which one.

>If you knew that the screen resolution was say, 1400 px wide, you could use
>a background image that was 1400 px wide and be confident it wouldn't
>repeat horizontally.
>
>Not that trying to do that would be a good idea -- but a relationship does
>exist.

So do virtual desktops and multi-head systems. Even if a script returns
1400px for screen width, the browser window can be much wider (on my
system for example it can span two screens, but a script will always
only return the size of one screen).

Micha

rf

unread,
Nov 21, 2004, 5:23:49 PM11/21/04
to
Michael Fesser

> I run a dual-head system: One screen is currently on 1600x1200px, the
> other on 1152x864px. What do you think the above function will return
> for screen width and height?

Notwithstanding that obtaining the dimensions of the screen is irrelevant to
web design:
screen.width and screen.height return the dimensions of your primary screen,
the one you have ticked to be primary monitor in display
properties>settings.

--
Cheers
Richard.


Michael Fesser

unread,
Nov 21, 2004, 6:18:23 PM11/21/04
to
.oO(rf)

>screen.width and screen.height return the dimensions of your primary screen,
>the one you have ticked to be primary monitor in display
>properties>settings.

Yep, except for my Firefox, where they return the dimensions of the
screen the browser runs on.

Micha

rf

unread,
Nov 21, 2004, 6:40:29 PM11/21/04
to
Michael Fesser wrote

How bizarre. So it does.

If the browser is positioned across two or more screens it seems to report
on whichever one it decides to place the alert (that I am using for testing)
on. I assume it chooses that screen that happens to be displaying most of
the browser at the moment :-)

--
Cheers
Richard.

Jan Faerber

unread,
Nov 22, 2004, 4:47:42 PM11/22/04
to
Sybren Stuvel wrote:

> Jan Faerber enlightened us with:
>> Thank you - you posted it already a second time now.
>
> I have? My server must have had a hickups.

No, not the server. You posted it aswell in another thread
where I asked the same question - 'css background problem'.

>> I have OpenOffice. Is there an integrated IE similar browser in
>> Crossover Office?
>
> Crossover Office is a fork of Wine, especially tweaked to run MS
> Office, MS Internet Explorer and other Windows applications. It is
> *not* an office suite.

I have to note that down.


--
Jan

http://html.janfaerber.com

Jan Faerber

unread,
Nov 22, 2004, 4:33:17 PM11/22/04
to
Toby Inkster wrote:

> Jan Faerber wrote:
>
>> So dpi has something to do
>>
>> [ ] with software
>> [ ] with hardware
>> [ ] with soft- and hardware
>
> There are two "dpi"s to consider:
>
> 1. Your real dpi. This is dependent on your physical screen size and the
> pixel size of your desktop. e.g. say your desktop is 800x600 and your
> screen is 15" (measured diagonally), then your dpi is:
>
> square_root(800^2 + 600^2) / 15 =~ 66.7.

so this is the hypotenuse divided by 15 ... that means 15" are 15 inch?
yes, so you say 'a 15 inch screen'? just talking to myself ... corr. me if I
am wrong.

> 2. Your configured dpi. This is the dpi your browser/operating
> system/whatever *believes* to be your real dpi. This is usually set in
> some "Advanced" tab of some settings screen, so is normally wrong.

I can not find that in a browser at the moment ...

> When you specify any sizes in physical sizes like inches, centimetres,
> points or whatever, your computer uses the configured dpi to "translate"
> the measurement into pixels so that it can display them on the screen.
>
> For example, my screen is 17" (16" viewable), 1280x1024 so has a real dpi
> of about 102.4. I have configured my dpi as 102.

I changed that now for me too.
It's much better - If the display on the screen is too big you loose
the ability to see small things in real life. It can't be small enough.

http://html.janfaerber.com/my_dpi_resolution.php

... I added here a navigation window now.
I found some problems with <a href="#"> to get the very top with opera
so I took css <a href="#top" style="position:absolute; top=0;">.

> So for a font size of 12pt, the browser thinks 12pt is 1/6 of an inch (a
> point is defined as 1/72 of an inch), which is exactly 17 pixels at 102
> dpi. So a 12pt font is drawn as 17px on my screen.

It is always a good feeling when the validation is correct.


--
Jan

http://html.janfaerber.com

Clemens

unread,
Feb 12, 2005, 2:59:34 PM2/12/05
to

Jan Faerber wrote:
> 213.47.90.101 - - [17/Nov/2004:18:32:52 +0100] "SEARCH
>
/\x90\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1\x02\xb1_etc...
> that is my best visitor!

Thanks to all who replyed last year to this posting ... with screen
resolution and all this things...
Today I was taking a look at my access_log file and found that somehow
the amount of visits of this 'line filler' is significantly decreasing!
In former months he came 5 - 10 times every 20 to 200 minutes. Now the
same is happening 'only' every 3 to 6 hours.


> --
> Jan
>
> http://html.janfaerber.com

0 new messages