HMTL高度和宽度,以长度为单位 [英] HMTL height and width in lenght unit of measurement

查看:82
本文介绍了HMTL高度和宽度,以长度为单位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


有没有办法在HTML中设置图像或表格单元的大小而不是按b / b $ b $像素,而是以英寸或毫米为单位?


这背后的问题是你永远不知道你的webcontent的消费者可能会使用什么样的输出设备。例如,他们可能会使用

电脑屏幕,但尺寸不同,分辨率也不同。

这意味着,在一个电脑屏幕上,一个像素的大小不同

比另一个。想象一下,在一台86 dpi(每英寸点数)的计算机屏幕上,图像的尺寸差异是44美元,比如我的旧的笔记本电脑,另一个是可能有138 dpi,就像我的新笔记本电脑一样!


结果可能是细节在

高分辨率屏幕上几乎不可见,例如非常小的文字将是不可读的除非

你把你的脸放在屏幕前面或使用你的网络浏览器的特殊缩放

功能。

那么,我们如何解决这个问题呢?

我们可以制作< img src =" foo.jpg"高度= QUOT;28毫米"宽度= QUOT;18毫米" / work?

我们如何让W3C将其纳入他们的标准?

不仅仅是图像,还有大小的东西! (会很好......)


感谢您的阅读,

期待您的评论。


Erich

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

推荐答案

2006-12-12,Erich Meier< er ********* @ invalid .invalidwrote:
On 2006-12-12, Erich Meier <er*********@invalid.invalidwrote:

你好,


有没有办法在HTML中设置图像或表格单元格的大小而不是通过

像素但是以英寸或毫米为单位?
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.


这背后的问题是你永远不知道什么样的输出设备

您的webcontent的消费者可能会使用。例如,他们可能会使用

电脑屏幕,但尺寸不同,分辨率也不同。

这意味着,在一个电脑屏幕上,一个像素的大小不同

比另一个。想象一下,在一台86 dpi(每英寸点数)的计算机屏幕上,图像的尺寸差异是44美元,比如我的旧的笔记本电脑,另一个是可能有138 dpi,就像我的新笔记本电脑一样!


结果可能是细节在

高分辨率屏幕上几乎不可见,例如非常小的文字将是不可读的除非

你把你的脸放在屏幕前面或使用你的网络浏览器的特殊缩放

功能。
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?


那么,我们怎样才能解决这个问题呢?

我们可以制作< img src =" foo.jpg"高度= QUOT;28毫米"宽度= QUOT;18毫米" /工作?
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;宽度:18毫米应该工作。


您也可以使用(英寸)或厘米。

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


Erich Meier< er * ********@invalid.invalidwrote:
Erich Meier <er*********@invalid.invalidwrote:

>有没有办法在HTML中设置图像或表格单元格的大小而不是通过
像素但以英寸或毫米为单位?

这背后的问题是你永远不知道你的webcontent的消费者可能使用什么样的输出设备。例如,他们可能会使用不同尺寸和不同分辨率的计算机屏幕。
这意味着,在一个计算机屏幕上,单个像素的大小与另一个像素大小不同。想象一下,计算机屏幕上的图像大小差异为44xpi(每英寸点数),就像我的旧笔记本电脑一样,另一个可能有138 dpi的图像,就像我的新版本一样笔记本电脑!

结果可能是细节在高分辨率屏幕上几乎看不到,例如非常小的文字将是不可读的,除非你把你的脸放在屏幕前面或使用你的网络浏览器的特殊缩放功能。

那么,我们如何解决这个问题问题?
>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)代码文本作为文本,文本不应嵌入图像中

各种明显的原因。
2)当表格用于其预期目的时(表格数据),

定期默认收缩适合机制最有效。在

的情况下,提供宽度有一个真正的好处,您可以使用HTML中编码的像素或百分比或任何已定义的CSS单元在

之间进行选择。 />
使用哪种内容取决于内容,通常在存在任何文本时

你应该使用em。单位。

3)目前还没有适合通用内容的好机制来处理分辨率差异很大的输出设备。在

实用水平上,当天输出设备中存在的差异

尚未导致

的可用性显着降低内容(除非你做一些愚蠢的事情,比如将小文本编码为

一个图像,解决方案是停止这样做)。

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


>我们可以制作< img src =" foo.jpg"高度= QUOT;28毫米"宽度= QUOT;18毫米" /工作?
>Can we make <img src="foo.jpg" height="28mm" width="18mm" /work?



不,HTML4中定义的高度和宽度值指的是

像素,如果是%,则为百分比。单位被添加。后者的用法是

表现形式和坏形式,因为这是CSS的领域。


提供图像的真实宽度和高度作为属性值

标记被认为是有用的,因为它有助于最大限度地减少回流。


使用代码让浏览器在任何地方显示位图图像

除了它的真实尺寸通常不聪明,因为浏览器通常会在调整图像大小时做得很差。

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.


>我们怎样才能让W3C将其纳入他们的标准?
不仅仅是图像,还有大小的东西! (会很好......)
>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...)



它已经是: http://www.w3.org/TR/CSS21/

-

Spartanicus

It already is: http://www.w3.org/TR/CSS21/

--
Spartanicus




Erich Meier写道:

Erich Meier wrote:

有没有办法设置HTML中图像或表格单元格的大小不是通过

像素,而是以英寸或毫米为单位?
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。近10年来,这已成为

标准的基本部分。


它在实践中的运作情况仅取决于浏览器,以及效果如何

了解映射到实际输出的物理大小

设备。它仍然不常见,但有很多人用这些物理

CSS长度单位切割乙烯基标志,印花T恤等等。 br />

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.


这篇关于HMTL高度和宽度,以长度为单位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆