473,499 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 17998
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2961
by: Ana | last post by:
I just ran a report on a site I'm redesigning and came up with all these missing height/width tags. How important are they? Should I go through the trouble of making sure they're there? Ana
5
6458
by: Dave Hammond | last post by:
You'd think this would be a basic part of the window object (and perhaps it is and I'm just being dense), but I can't find any reference in the IE window object documentation to a property which...
5
5912
by: Linda | last post by:
Hi, I'm trying to get the Left/Top/Height/Width properties for some text boxes on a form to match exactly. Three of them are fine, but the fourth will not accept the changes I type into the...
1
2539
by: Pums | last post by:
How to get the information(like height, width) of an image to be uploaded?
9
19484
by: Adam | last post by:
Can someone please help!! I am trying to figure out what a font is? Assume I am working with a fixed font say Courier 10 point font Question 1: What does this mean 10 point font Question 2:...
8
2420
by: Kentor | last post by:
Hello, I have users that submit images to my website. By default I choose to make the width bigger than the height because usually pictures are taken horizontally... But in some cases people take...
4
4317
by: Christopera | last post by:
Hello, I have built a site that uses two divs, one verticle, and one horizontal as graphic style for the ite. The problem I am having is that if the browser is resized very small the divs are...
0
7006
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
7169
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,...
1
6892
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...
0
7385
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...
0
5467
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4917
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
4597
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...
0
1425
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
661
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.