469,923 Members | 1,631 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

HMTL height and width in lenght unit of measurement

Hello there,

is there any way to set the size of images or table cells in HTML not by
pixels but by inches or in millimetres?

The problem behind this is that you never know what kind of output device
the consumers of your webcontent may use. For example they may use
computer screens, but in different sizes and with different resolutions.
That means, on one computer screen a single pixel has a different size
than on another. Just imagine the size difference of an image that is
400x300 on a computer screen that has 86 dpi (dots per inch), like my old
laptop, and another one that might have 138 dpi, like my new laptop!

The result of this could be that details are almost invisible on
high-resolution screens, e.g. very small text will be unreadable unless
you put your face right in front of the screen or use special zoom
functions of your web browser.

So, how can we solve this problem?
Can we make <img src="foo.jpg" height="28mm" width="18mm" /work?
How can we ask W3C to put this into their Standard?
And not only for images, for everything that has a size! (Would be nice...)

Thank you for reading,
looking forward to your comments.

Erich

Dec 12 '06 #1
18 16344
On 2006-12-12, Erich Meier <er*********@invalid.invalidwrote:
Hello there,

is there any way to set the size of images or table cells in HTML not by
pixels but by inches or in millimetres?
Yes.
The problem behind this is that you never know what kind of output device
the consumers of your webcontent may use. For example they may use
computer screens, but in different sizes and with different resolutions.
That means, on one computer screen a single pixel has a different size
than on another. Just imagine the size difference of an image that is
400x300 on a computer screen that has 86 dpi (dots per inch), like my old
laptop, and another one that might have 138 dpi, like my new laptop!

The result of this could be that details are almost invisible on
high-resolution screens, e.g. very small text will be unreadable unless
you put your face right in front of the screen or use special zoom
functions of your web browser.
Setting absolute sizes is often not a good idea though. What about a
large display in an airport or somewhere?
So, how can we solve this problem?
Can we make <img src="foo.jpg" height="28mm" width="18mm" /work?
<img src="foo.jpg" style="height: 28mm; width: 18mm"should work.

You can also use in (inches) or cm.
And not only for images, for everything that has a size! (Would be nice...)
Should also work already!
Dec 12 '06 #2
Erich Meier <er*********@invalid.invalidwrote:
>is there any way to set the size of images or table cells in HTML not by
pixels but by inches or in millimetres?

The problem behind this is that you never know what kind of output device
the consumers of your webcontent may use. For example they may use
computer screens, but in different sizes and with different resolutions.
That means, on one computer screen a single pixel has a different size
than on another. Just imagine the size difference of an image that is
400x300 on a computer screen that has 86 dpi (dots per inch), like my old
laptop, and another one that might have 138 dpi, like my new laptop!

The result of this could be that details are almost invisible on
high-resolution screens, e.g. very small text will be unreadable unless
you put your face right in front of the screen or use special zoom
functions of your web browser.

So, how can we solve this problem?
1) Code text as text, text should not be embedded in an image for
various obvious reasons.
2) When tables are used for their intended purpose (tabular data),
regularly the default shrink to fit mechanism works best. In cases where
there is a real benefit to supplying a width you have a choice between
using pixels or percentages coded in the HTML, or any defined CSS unit.
Which to use depends on the content, typically when any text is present
you should use the "em" unit.
3) There is currently no good mechanism suitable for generic content for
dealing with output devices with wildly varying resolution. On a
practical level the differences that exist in current day output devices
do not as yet result in a significant degradation of the usability of
the content (unless you do something dumb such as coding small text as
an image for which the solution is "stop doing that").
>Can we make <img src="foo.jpg" height="28mm" width="18mm" /work?
No, the values for the height and width as defined in HTML4 refer to
pixels, or percentages if the "%" unit is added. Usage of the latter is
presentational and bad form since that is the domain of CSS.

Supplying the true width and height of an image as attribute values in
the markup is considered helpful as it helps to minimize reflows.

Using code to get a browser to display a bitmapped image at anything
else than it's true size is often not smart as browsers typically do a
poor job at resizing images.
>How can we ask W3C to put this into their Standard?
And not only for images, for everything that has a size! (Would be nice...)
It already is: http://www.w3.org/TR/CSS21/

--
Spartanicus
Dec 12 '06 #3

Erich Meier wrote:
is there any way to set the size of images or table cells in HTML not by
pixels but by inches or in millimetres?
CSS. For nearly 10 years now this has been a basic part of the
standard.

How well it works in practice just depends on the browser, and how well
that understands the mapping to the physical size of its actual output
device. It's still not commonly done, but there are plenty of people
cutting vinyl signs, printing T-shirts and the like with these physical
CSS length units.

Dec 12 '06 #4
>Can we make <img src="foo.jpg" height="28mm" width="18mm" /work?
>
<img src="foo.jpg" style="height: 28mm; width: 18mm"should work.

You can also use in (inches) or cm.
Great!

And stupid me, I didn't even THINK of CSS. Of course it does the
trick!

Thanks!

Erich

Dec 12 '06 #5
Erich Meier wrote:
Hello there,

is there any way to set the size of images or table cells in HTML not by
pixels but by inches or in millimetres?

The problem behind this is that you never know what kind of output device
the consumers of your webcontent may use. For example they may use
computer screens, but in different sizes and with different resolutions.
That means, on one computer screen a single pixel has a different size
than on another. Just imagine the size difference of an image that is
400x300 on a computer screen that has 86 dpi (dots per inch), like my old
laptop, and another one that might have 138 dpi, like my new laptop!

The result of this could be that details are almost invisible on
high-resolution screens, e.g. very small text will be unreadable unless
you put your face right in front of the screen or use special zoom
functions of your web browser.

So, how can we solve this problem?
Can we make <img src="foo.jpg" height="28mm" width="18mm" /work?
How can we ask W3C to put this into their Standard?
And not only for images, for everything that has a size! (Would be nice...)

Thank you for reading,
looking forward to your comments.

Erich
Be careful not to set the size appropriate only for large-screen
monitors. You don't want to make the pages unviewable on Web-capable
cell phones. Or do you?

Jakob Nielsen (Web useability guru) rejects tiny cell phone monitors but
still strongly recommends that pages be flexible enough to view well
with "only" 800x600 resolution (which is the resolution I prefer) and
also with 1280x1024. See
<http://www.useit.com/alertbox/screen_resolution.html>.

However, if you are designing something to be viewed ONLY on a
specialized monitor screen, then -- of course -- you should design
specifically for that monitor.

--

David E. Ross
<http://www.rossde.com/>

I use SeaMonkey as my Web browser because I want
a browser that complies with Web standards. See
<http://www.mozilla.org/projects/seamonkey/>.
Dec 13 '06 #6

David E. Ross wrote:
Be careful not to set the size appropriate only for large-screen
monitors. You don't want to make the pages unviewable on Web-capable
cell phones. Or do you?
Of course you do. If you're in one of those rare but valid situations
where using any physical unit is appropriate, then it's perfetly valid
to make the page unworkable on small-screen devices, or even on
large-screen devices.

The "best practice" isn't "Always work on a screen of less than 2"
across", it's "Implement so that it works on whatever it has to". Don't
just use a smaller number of mm, use ems instead.

Dec 13 '06 #7
Scripsit Andy Dingley:
Erich Meier wrote:
>is there any way to set the size of images or table cells in HTML
not by pixels but by inches or in millimetres?

CSS. For nearly 10 years now this has been a basic part of the
standard.
What standard? CSS is not part of HTML standard for sure, whatever you mean
my "standard".

The correct answer to the question is thus "No". Or "No, but consider CSS".

CSS hasn't in fact been standardized even the lame way HTML has. But the
width and height properties are reasonably consistently defined in various
obsolete specifications and not-yet-approved drafts.
How well it works in practice just depends on the browser, and how
well that understands the mapping to the physical size of its actual
output device.
Basically, it does not work. Setting width and height in mm would mean
creating a problem, not solving one.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Dec 14 '06 #8
..oO(Jukka K. Korpela)
>Scripsit Andy Dingley:
>Erich Meier wrote:
>>is there any way to set the size of images or table cells in HTML
not by pixels but by inches or in millimetres?

CSS. For nearly 10 years now this has been a basic part of the
standard.

What standard?
| CSS. For nearly 10 years now this [defining lengths in mm] has been a
| basic part of the standard [CSS].

At least that was my understanding.
>The correct answer to the question is thus "No". Or "No, but consider CSS".
The short answer "CSS" might not have been correct IYHO, but it was
accurate.
>How well it works in practice just depends on the browser, and how
well that understands the mapping to the physical size of its actual
output device.

Basically, it does not work. Setting width and height in mm would mean
creating a problem, not solving one.
Depends on the target media. For screen stylesheets it's useless, but it
might work for printing.

Micha
Dec 14 '06 #9

Jukka K. Korpela wrote:
Basically, it does not work. Setting width and height in mm would mean
creating a problem, not solving one.
Of course it works, for at least some contexts. And without knowing
more about the OP's that's sufficient to answer their vague generalised
question.

I've seen at least two physical machines in this town that understand
CSS with mm units. One guillotines and folds cardboard for on-demand
printing, the user is a water-jet cutter that makes signs.

Dec 14 '06 #10
..oO(Erich Meier)
>is there any way to set the size of images or table cells in HTML not by
pixels but by inches or in millimetres?
CSS.
>The problem behind this is that you never know what kind of output device
the consumers of your webcontent may use. For example they may use
computer screens, but in different sizes and with different resolutions.
[...]

So, how can we solve this problem?
You can't really.
>Can we make <img src="foo.jpg" height="28mm" width="18mm" /work?
How can we ask W3C to put this into their Standard?
It's already possible with CSS, but to make it really work it would
require proper dpi/ppi settings on the client machines. And you can be
sure that more than 95% of all systems are _not_ properly configured.
The average user doesn't even know what dpi is, so you can forget this.

Micha
Dec 14 '06 #11
Scripsit Michael Fesser:
.oO(Jukka K. Korpela)
How very funny. "Funny" attributions is just what the world needs more.
>Scripsit Andy Dingley:
>>Erich Meier wrote:
is there any way to set the size of images or table cells in HTML
not by pixels but by inches or in millimetres?

CSS. For nearly 10 years now this has been a basic part of the
standard.

What standard?
>CSS. For nearly 10 years now this [defining lengths in mm] has been a
basic part of the standard [CSS].

At least that was my understanding.
You might be right. But you had to add the bracketed words to make the
statement make sense (though not true - there's no standard for CSS, still
less a single standard).
>The correct answer to the question is thus "No". Or "No, but
consider CSS".

The short answer "CSS" might not have been correct IYHO, but it was
accurate.
This group is for discussing HTML authoring for the WWW. In this context,
any correct answer starts with "No".
>Basically, it does not work. Setting width and height in mm would
mean creating a problem, not solving one.

Depends on the target media. For screen stylesheets it's useless, but
it might work for printing.
In the context of the World Wide Web, no. You cannot even know the paper
size in the user's printer. In a _user_ style sheet, setting dimensions in
pixels, millimeters, and whatever may make perfect sense. But this is an
_authoring_ group.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Dec 14 '06 #12
..oO(Jukka K. Korpela)
>Scripsit Michael Fesser:
>.oO(Jukka K. Korpela)

How very funny. "Funny" attributions is just what the world needs more.
Don't start flaming on things like that like a troll! What I use in the
attribution line is completely up to _me_, like a signature. Or do you
see me complaining about your non-English attribution in an English-
speaking group?
>You might be right. But you had to add the bracketed words to make the
statement make sense (though not true - there's no standard for CSS, still
less a single standard).
Keep on nitpicking if you like.
>The short answer "CSS" might not have been correct IYHO, but it was
accurate.

This group is for discussing HTML authoring for the WWW. In this context,
any correct answer starts with "No".
No.

Micha
Dec 14 '06 #13
Scripsit Michael Fesser:
.oO(Jukka K. Korpela)
Your attributions do not conform to any usual style in international groups,
and they aren't even _apparent_ attributions at all. And they are even less
funny than the first time.
>This group is for discussing HTML authoring for the WWW. In this
context, any correct answer starts with "No".

No.
So you had nothing to say but a false claim with no argument in favor of it,
yet you decided to spend several lines of text for the message.

Maybe you know a secret way of using mm in HTML, but you've resisted the
temptation to reveal it. (Though I'd bet you just can't tell CSS from HTML.)

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Dec 14 '06 #14

Jukka K. Korpela wrote:
This group is for discussing HTML authoring for the WWW.
Yes, and sometimes people ask things that aren't strictly on topic.

Now which is more useful and interesting? A reasonable response to a
reasonable (if off-topic) question. Or your pointless egotistical
sophistry?
In this context,
any correct answer starts with "No".
Don't feel that you _have_to_ contribute.

Dec 14 '06 #15
Jukka K. Korpela wrote:
Scripsit Michael Fesser:
>.oO(Jukka K. Korpela)
>>Basically, it does not work. Setting width and height in mm would
mean creating a problem, not solving one.

Depends on the target media. For screen stylesheets it's useless, but
it might work for printing.

In the context of the World Wide Web, no. You cannot even know the paper
size in the user's printer. In a _user_ style sheet, setting dimensions
in pixels, millimeters, and whatever may make perfect sense. But this is
an _authoring_ group.
If the goal is to provide a template for some DIY project that a user
can print out to place, for example, on top of a plank of wood for the
purpose of knowing where to saw and drill, then this makes perfectly
good sense, assuming the equipment will follow the CSS faithfully, of
course. If the template is 25 cm wide by 20 cm high, then anyone
printing on the usual A4 or 8-1/2" x 11" paper will get what's expected,
and of course it won't work if someone tries to print the template out
on a typical photo printer.

Of course, this is an extreme example.
Dec 14 '06 #16
..oO(Jukka K. Korpela)
>Scripsit Michael Fesser:
>.oO(Jukka K. Korpela)

Your attributions do not conform to any usual style in international groups,
Show me such a "style guide" for attribution lines (apart from being
just one line long and mentioning the quoted author). URL maybe?
>and they aren't even _apparent_ attributions at all. And they are even less
funny than the first time.
You're not supposed to laugh about it. Just ignore it.
>>This group is for discussing HTML authoring for the WWW. In this
context, any correct answer starts with "No".

No.

So you had nothing to say but a false claim with no argument in favor of it,
A paradox: It started with a "No", so it must have been correct.
>yet you decided to spend several lines of text for the message.
There are people who write ten lines of text, even if the same could be
said in less than three, just for the sake of "hearing their own voice".
>Maybe you know a secret way of using mm in HTML, but you've resisted the
temptation to reveal it. (Though I'd bet you just can't tell CSS from HTML.)
You lost.

While I appreciate your knowledge, your social competence could be
called "invalid" from time to time.

Micha
Dec 14 '06 #17
Scripsit Michael Fesser:
>>>This group is for discussing HTML authoring for the WWW. In this
context, any correct answer starts with "No".

No.

So you had nothing to say but a false claim with no argument in
favor of it,

A paradox: It started with a "No", so it must have been correct.
There's no paradox. You did not answer the original question but commented
on my message.

Your pointless babbling and false claims might give you credits in a
competition on social skills - I never said I was good at them -, but in a
group like this, you're collecting negative credits, pretty fast.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Dec 14 '06 #18
..oO(Jukka K. Korpela)
>Your pointless babbling and false claims might give you credits in a
competition on social skills - I never said I was good at them -, but in a
group like this, you're collecting negative credits, pretty fast.
I'm not the only one on that.

EOT & Fup2 poster
Micha
Dec 14 '06 #19

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Ana | last post: by
5 posts views Thread by Dave Hammond | last post: by
9 posts views Thread by Adam | last post: by
8 posts views Thread by Kentor | last post: by
reply views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.