表宽度错误??? [英] Table width error???

查看:63
本文介绍了表宽度错误???的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我误解了CSS规范还是Firefox(版本1.0.6)

(和Opera)做错了什么?

看来Firefox 1.0.6在宽度计算中包含边框

用于表格但不包括高度计算。


哦,和Opera版本8.02做同样的事情。


|< - > | |< - > | < ------ border

|< ------------> | < ------表格内容

|< ----------------------> | < ------由Firefox渲染的宽度

(*包括*边框)

(它应该是
$ b $的宽度b内容,不应该吗?)

+ ------------------------ + -----

| | < --- border

| + -------------- + | -----

| | | | ^

| | | | | < ---内容和高度

| | | | v(高度不包括边界)

| + -------------- + | -----

| | < --- border

+ ------------------------ + -----

我可以得到一张我想要正确渲染的桌子而不指定高度

和宽度但是,在这种情况下,桌子的边框最初太小而且
$ b然后,当从完全读取表时,从HTML

读取行时,$ b然后重新绘制,并且大小不断增加。 (

实际表格比例子大* *大* 32行和列

,高度和宽度用JavaScript动态调整,所以只有

一些(9行和9列)在任何给定时间都可见。)我想

在开始时指定表格可见部分的大小,所以

border可以立即以正确的大小绘制。


用于示例6列,2行表格的HTML的一部分,带有图像:


....

....

< h2>未指定高度和宽度< / h2>

< table style =" border:32px ridge#50C040; font-size:0px;填充:0 cellspacing =" 1">

....

....

< h2>高度= 127px; width = 431px< / h2>

< h3>(高度= 2 *图像高度+1;宽度= 6 *图像宽度+5)< / h3>

< p>该表应与上述相同 - 但不是。< / p>

< table style =" border:32px ridge#50C040; font-大小:0px;填充:0;身高:127px;宽度:431像素cellspacing =" 1">

....

....

< h2>高度= 127px; width = 495px< / h2>

< h3>(高度= 2 *图像高度+ 1;宽度= 6 *图像宽度+ 5 + 64)< / h3>

< p>将边框宽度的两倍加到宽度上似乎可以纠正尺寸问题

但是边框尺寸不应该对内容区域的大小产生任何影响

表。< / p>

< table style =" border:32px ridge#50C040; font-size:0px;填充:0;身高:127px;宽度:495像素cellspacing =" 1">

....

....

但是,Firefox的处理宽度说明符(但不是高度

说明符)似乎反直觉地包括边界。完整的

示例文件(6KB):
http://www.chebucto.ns.ca/~af380/Tab...idthError.html


第一张表缺少高度和宽度对于整体表格样式,

第二个有宽度I *认为*我应该使用并且渲染太多

小而第三个表格呈现我想要的大小但是我不认为
认为Firefox或Opera真的做对了。


所以,我错了还是Firefox和Opera都错了?


-

``为什么你找不到更合适的新闻组来发布这个肚子?

这是一个完全不同的视力障碍的聚会场所。

抓住我的漂移?'''' - jim在alt.disability.blind.social关于

偏离主题的宗教/政治帖子,2005年3月28日


Am I misunderstanding the CSS specifications or is Firefox (version 1.0.6)
(and Opera) doing the wrong thing?

It appears that Firefox 1.0.6 includes the border in width calculations
for tables but not in height calculations.

Oh, and Opera version 8.02 does the same thing.

|<-->| |<-->| <------ border
|<------------>| <------ table contents
|<---------------------->| <------ width as rendered by Firefox
(*includes* border)
(it should be the width of the
contents, shouldn''t it?)
+------------------------+ -----
| | <--- border
| +--------------+ | -----
| | | | ^
| | | | | <--- contents and height
| | | | v (height excludes border)
| +--------------+ | -----
| | <--- border
+------------------------+ -----
I can get a table I want to render correctly without specifying a height
and width but, in that case, the table''s border is initially too small and
then redrawn with an ever-increasing size as rows are read from the HTML
and only reaches the correct size when the table is entirely read. (The
actual table is *much* larger than the example one, 32 rows and columns
with the height and width dynamically adjusted with JavaScript so only
some (9 rows and 9 columns) are visible at any given time.) I wanted to
specify the size of the visible part of the table at the start so the
border could immediately be drawn at the right size.

A portion of the HTML for an example 6-column, 2-row table with images:

....
....
<h2>No height and width specified</h2>
<table style="border:32px ridge #50C040;font-size: 0px; padding: 0" cellspacing="1">
....
....
<h2>Height = 127px; width = 431px</h2>
<h3>(Height = 2 * image height + 1; Width = 6 * image width + 5)</h3>
<p>The table should be the same as above -- but isn''t.</p>
<table style="border:32px ridge #50C040;font-size: 0px; padding: 0; height: 127px; width: 431px" cellspacing="1">
....
....
<h2>Height = 127px; width = 495px</h2>
<h3>(Height = 2 * image height + 1; Width = 6 * image width + 5 + 64)</h3>
<p>Adding twice the width of the border to the width seems to correct the size problem
but the border size should not have had any influence on the size of the content area
of the table.</p>
<table style="border:32px ridge #50C040;font-size: 0px; padding: 0; height: 127px; width: 495px" cellspacing="1">
....
....
However, Firefox''s treatment of a width specifier (but not the height
specifier) seems to counter-intuitively include the border. The complete
example file (6KB):
http://www.chebucto.ns.ca/~af380/Tab...idthError.html

The first table lacks height and width for the overall table style,
the second has the width I *thought* I should use and gets rendered too
small and the third table gets rendered the size I want but I don''t
think Firefox or Opera are really doing the right thing.

So, am I wrong or are both Firefox and Opera wrong?

--
``Why don''t you find a more appropiate newsgroup to post this tripe into?
This is a meeting place for a totally differnt kind of "vision impairment".
Catch my drift?'''' -- "jim" in alt.disability.blind.social regarding an
off-topic religious/political post, March 28, 2005

推荐答案

Norman L. DeForest < AF *** @ chebucto.ns.ca>写道:
"Norman L. DeForest" <af***@chebucto.ns.ca> wrote:
似乎Firefox 1.0.6包含宽度计算边框,但不包括高度计算。
It appears that Firefox 1.0.6 includes the border in width calculations
for tables but not in height calculations.



桌子不需要特定的高度。停止滥用桌子。


-

Spartanicus



Tables don''t need specified heights, ever. Stop abusing tables.

--
Spartanicus




2005年9月16日星期五,Spartanicus写道:

On Fri, 16 Sep 2005, Spartanicus wrote:
" Norman L. DeForest" < AF *** @ chebucto.ns.ca>写道:
"Norman L. DeForest" <af***@chebucto.ns.ca> wrote:
似乎Firefox 1.0.6包含宽度计算边框,但不包括高度计算。
It appears that Firefox 1.0.6 includes the border in width calculations
for tables but not in height calculations.


表格不需要特定的高度。停止滥用表格。



Tables don''t need specified heights, ever. Stop abusing tables.




为什么滥用? CSS规格似乎支持它:


[snip]

:17.5.3桌面高度算法



:表格的高度由''table'''/ b $ b:或''inline-table''元素的''height''属性给出。值''auto''表示高度为

:行高的总和加上任何单元格间距或边框。任何其他

:值明确指定高度;因此,桌子可能比它的行高更短或者b $ b:b更短。 ''table'''''''''''''''''''''''''''''''''''''''' CSS 2.1没有定义额外的

:当''height''属性导致表格为/ b $ b时,空间是分布的:比其他情况更高。注意。 CSS的未来版本可以

:进一步指定。

[snip]


如果指定了高度和宽度表格,边框可以立即以正确的尺寸显示
。如果高度和宽度没有规格

,Firefox最初会显示错误的大小(太小了b / b小)边框,然后慢慢扩大表格边框,因为更多的<读取
行。这就是我想指定大小的原因 - 所以

边框会立即显示正确的大小。没有问题

不同的文字大小,因为表格只使用固定大小的图像。

这怎么可能是滥用?
< br $>
(你不是真的*必须在网页上指定图像的大小

(如果你没有让浏览器在其他地方显示它们)因为浏览器最终可以确定图像尺寸

加载图像但是包含大量图像的页面将是

重新排列了多次,因为你没有在你的

HTML中指定图像大小,因此更多的东西跳到了更多的地方。 )


然而,我的问题是关于*宽度*似乎计算错误。


我是对的,Firefox和Opera错误计算宽度通过在*指定宽度的表区域中包含

border *或者我错了吗?

为什么边界包含在当指定高度不包含
时指定的宽度?


-

``为什么要'你找到一个更合适的新闻组来发布这个肚子吗?

这是一个完全不同的视力障碍的聚会场所。

抓住我的漂移?'''' - 吉姆在alt.disability.blind.social关于

偏离主题的宗教/政治帖子,2005年3月28日



Why is it misuse? The CSS specs appear to support it:

[snip]
: 17.5.3 Table height algorithms
:
: The height of a table is given by the ''height'' property for the ''table''
: or ''inline-table'' element. A value of ''auto'' means that the height is
: the sum of the row heights plus any cell spacing or borders. Any other
: value specifies the height explicitly; the table may thus be taller or
: shorter than the height of its rows. The ''height'' property on ''table''
: boxes is treated as a minimum height. CSS 2.1 does not define how extra
: space is distributed when the ''height'' property causes the table to be
: taller than it otherwise would be. Note. Future versions of CSS may
: specify this further.
[snip]

If the height and width are specified for the table, the border can be
displayed immediately with the correct size. If there is no specification
for the height and width, Firefox initially displays the wrong size (too
small) border and then slowly enlarges the table border as more of the
rows are read. That is the reason I wanted to specify the size -- so the
border would appear the correct size immediately. There is no problem of
varying text sizes as the table will be using only fixed-sized images.
How can this be "abuse"?

(You don''t *really* have to specify the size of images on a web page
either (if you''re not having the browser display them in other than their
correct size) since the browser can eventually determine image size when
an image is loaded but a page with lots of images is going to be
rearranged multiple times with stuff hopping all over the place as more
and more images are fetched if you don''t specify the image sizes in your
HTML.)

HOWEVER, my question was about the *width* appearing to be miscalculated.

Am I right that Firefox and Opera miscalculate the width by including the
border *within* the table area whose width is specified or am I wrong?
And why is the border included within the specified width when it isn''t
included within the specified height?

--
``Why don''t you find a more appropiate newsgroup to post this tripe into?
This is a meeting place for a totally differnt kind of "vision impairment".
Catch my drift?'''' -- "jim" in alt.disability.blind.social regarding an
off-topic religious/political post, March 28, 2005


" ; Norman L. DeForest < AF *** @ chebucto.ns.ca>写道:
"Norman L. DeForest" <af***@chebucto.ns.ca> wrote:
>看来Firefox 1.0.6包含宽度计算中的边框
> ;对于桌子而不是高度计算。
表格不需要特定的高度。停止滥用表格。
>It appears that Firefox 1.0.6 includes the border in width calculations
>for tables but not in height calculations.
Tables don''t need specified heights, ever. Stop abusing tables.



为什么滥用?



Why is it misuse?




表用于标记表格数据,应允许内容到

扩展容器(文本缩放等)

CSS规范似乎支持它:


CSS支持 ;各种不恰当的用法,这并不能证明

这样做。

如果为表格指定了高度和宽度,边框可以是
立即显示正确的大小。


不相关,边界不满足。页面可能会稍微更快地布局

,但代价更重要

功能。

如果没有规范<对于高度和宽度,Firefox最初会显示错误的大小(太小)边框,然后在读取更多的行时慢慢放大表格边框。


网址?设置空单元设置为显示?

这就是我想指定大小的原因 - 所以
边框会立即显示正确的大小。由于表格仅使用固定大小的图像,因此不存在文本大小不同的问题。
这怎么可能是滥用?


这些图像是否为表格数据?


用户禁用图像显示,alt文本显示,固定宽度/高度

表占用了屏幕空间。

(你不是真的*必须在网页上指定图像的大小
要么(如果你不是)由于浏览器最终可以在加载图像时确定图像大小但是包含大量图像的页面将重新排列多次,因此浏览器会将其显示为正确大小以外的大小。如果你没有在你的
HTML中指定图像大小,那么随着更多的东西跳来跳去的东西更多
和更多的图像。)


当alt内容为
显示折叠时,图像框占据的屏幕空间。

但是,我的问题是关于*宽度*似乎计算错误。

我是对的,Firefox和Opera通过在表格区域内包含
边框*来错误计算宽度宽度是指定的还是我错了?



Tables are for marking up tabular data, the content should be allowed to
expand the container (text zooming etc.)
The CSS specs appear to support it:
CSS "supports" all sorts of inappropriate use, that doesn''t justify
doing so.
If the height and width are specified for the table, the border can be
displayed immediately with the correct size.
Not relevant, borders aren''t content. The page might be laid out
slightly more quickly, but at the expense of much more important
functionality.
If there is no specification
for the height and width, Firefox initially displays the wrong size (too
small) border and then slowly enlarges the table border as more of the
rows are read.
URL? Set "empty-cells" set to "show"?
That is the reason I wanted to specify the size -- so the
border would appear the correct size immediately. There is no problem of
varying text sizes as the table will be using only fixed-sized images.
How can this be "abuse"?
Are these images tabular data?

User has image display disabled, alt text shows, your fixed width/height
table is hogging the screen space.
(You don''t *really* have to specify the size of images on a web page
either (if you''re not having the browser display them in other than their
correct size) since the browser can eventually determine image size when
an image is loaded but a page with lots of images is going to be
rearranged multiple times with stuff hopping all over the place as more
and more images are fetched if you don''t specify the image sizes in your
HTML.)
The screen space occupied by an image''s box when the alt content is
showing collapses.
HOWEVER, my question was about the *width* appearing to be miscalculated.

Am I right that Firefox and Opera miscalculate the width by including the
border *within* the table area whose width is specified or am I wrong?




默认表格border由两部分组成,围绕桌子的边框,

和细胞周围的边框。除非是空单元。设置为显示,

浏览器可以在图像滚动时逐步激活单元格边框

in。


-

Spartanicus



Default table "borders" consist of two parts, a border around the table,
and a border around cells. Unless "empty-cells" is set to "show", a
browser may activate the cell borders incrementally as the images roll
in.

--
Spartanicus


这篇关于表宽度错误???的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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