Colspan - rowspan HTML表
您好!
我正在尝试制作一种在线页面构建系统。为了
这样做,我使用HTML表代表我的页面。一个最基本的
模板将是一个页面,分为六个等比例的
矩形:
< table border = " 1 QUOT; CELLSPACING = QUOT; 0" CELLPADDING = QUOT; 0" width =" 200"
height =" 200">
< tr>
< td colspan =" 2" ; rowspan =" 4"> ABC< / td>
< td colspan =" 2" rowspan =" 4"> DEF< / td>
< / tr>
< tr>
< td colspan = QUOT; 2英寸rowspan =" 4"> GHI< / td>
< td colspan =" 2" rowspan =" 4"> JKL< / td>
< / tr>
< tr>
< td colspan = QUOT; 2英寸rowspan =" 4"> MNO< / td>
< td colspan =" 2" rowspan =" 4"> PQR< / td>
< / tr>
< / table>
我原以为这会显示如下:
| ------- | ------- |
| ABC | DEF |
| ------- | ------- |
| GHI | JKL |
| ------- | ------- |
| MNO | PQR |
| ------- | ------- |
正如您在复制粘贴代码段时所看到的,这不是这个案例。
我不能保留colspan / rowspan属性,因为这个表
是使用ASP动态构建的。如果我使用一个包含4列和12
行的表,我可以支持相当广泛的模板,例如:
| --------- ------ | | --------------- | | ------- | ------- |
| ABC | | | | ABC | |
| --------------- | | ABC | | ------- | |
| DEF | | | | | DEF |
| --------------- | | ------- | ------- | | GHI | |
| GHI | | DEF | GHI | | | |
| --------------- | | ------- | ------- | | ------- | ------- | ...
所以我的问题是:有人可以解释为什么表格没有按预期显示吗?
我也读过这个新闻组中的一些帖子,说明使用
表来做上面描述的事情是表格不好的表格
技术。所以我想问一下是否有人有其他建议
完成上述功能。
提前Thx!
Joris
Hello!
I''m trying to make a sort of online page building system. In order to
do this, I represent my page using a HTML table. One of the most basic
templates would be a page divided in six equally proportioned
rectangles:
<table border="1" cellspacing="0" cellpadding="0" width="200"
height="200">
<tr>
<td colspan="2" rowspan="4">ABC</td>
<td colspan="2" rowspan="4">DEF</td>
</tr>
<tr>
<td colspan="2" rowspan="4">GHI</td>
<td colspan="2" rowspan="4">JKL</td>
</tr>
<tr>
<td colspan="2" rowspan="4">MNO</td>
<td colspan="2" rowspan="4">PQR</td>
</tr>
</table>
I was expecting that this would be displayed as follows:
|-------|-------|
| ABC | DEF |
|-------|-------|
| GHI | JKL |
|-------|-------|
| MNO | PQR |
|-------|-------|
As you can see when you copy-paste the snippet, this is not the case.
I cannot leave the colspan/rowspan attributes out because this table
is dynamically build using ASP. If I use a table with 4 columns and 12
rows, I can support a rather wide range of templates such as:
|---------------| |---------------| |-------|-------|
| ABC | | | | ABC | |
|---------------| | ABC | |-------| |
| DEF | | | | | DEF |
|---------------| |-------|-------| | GHI | |
| GHI | | DEF | GHI | | | |
|---------------| |-------|-------| |-------|-------| ...
So my question is: can anyone explain why the table isn''t being
displayed as expected?
I''ve also read some posts in this newsgroup stating that the use of
tables to do things as described above is "symptomatic of poor table
technique". So I would like to ask if someone has other suggestions to
accomplish the features described above.
Thx in advance!
Joris
在19/8/04 10:08 am,Logix写道:
On 19/8/04 10:08 am, Logix wrote:
我不能保留colspan / rowspan属性,因为这个表是使用ASP动态构建的。如果我使用一个包含4列和12行的表格,我可以支持相当广泛的模板
I cannot leave the colspan/rowspan attributes out because this table
is dynamically build using ASP. If I use a table with 4 columns and 12
rows, I can support a rather wide range of templates
我不明白。
你可以在ASP中动态构建你喜欢的任何东西。包括有效的HTML。
目前你的表格是用重叠的单元格定义的,所以它没有
惊喜它没有正确渲染。
-
Philip Ronan
ph *********** @ virgin.net
(如果通过电子邮件回复,请删除z)
I don''t understand that.
You can dynamically build whatever you like in ASP. Including valid HTML.
At the moment your table is defined with overlapping cells, so it''s no
surprise it isn''t rendering properly.
--
Philip Ronan
ph***********@virgin.net
(Please remove the "z"s if replying by email)
lo******@hotmail.com (Logix)写道:
lo******@hotmail.com (Logix) wrote:
您好!
我正在尝试制作一种在线页面构建系统。为了做到这一点,我使用HTML表来表示我的页面。最基本的模板之一是分为六个等比例矩形的页面:
< table border =" 1" CELLSPACING = QUOT; 0" CELLPADDING = QUOT; 0" width =" 200"
height =" 200">
< tr>
< td colspan =" 2" rowspan =" 4"> ABC< / td>
< td colspan =" 2" rowspan =" 4"> DEF< / td>
< / tr>
< tr>
< td colspan =" 2" rowspan =" 4"> GHI< / td>
< td colspan =" 2" rowspan =" 4"> JKL< / td>
< / tr>
< tr>
< td colspan =" 2" rowspan =" 4"> MNO< / td>
< td colspan =" 2" rowspan =" 4"> PQR< / td>
< / tr>
< / table>
我原以为这会显示如下:
| ------- | ------- |
| ABC | DEF |
| ------- | ------- |
| GHI | JKL |
| ------- | ------- |
| MNO | PQR |
| ------- | ------- |
正如您在复制粘贴代码段时所看到的那样,情况并非如此。
当然不是。如果您阅读HTML指南以了解哪些rowspan
和colspan,您会发现它。或者转到规范:
http://www.w3.org/TR/html4/struct/ta...tml#h-11.2.6.1
例如,如果包含ABC的TD跨越四行和两列,
然后这意味着它占据了表格的前四个行(TR)中的前两列。如果它占据了第二行
中的前两列,则GHI被推到第二行
的第三列。此外,虽然表格中的每个TD都表示为跨越四行的
,但是你的表格甚至没有任何一行可以跨越四行。它只有三个。
我不能保留colspan / rowspan属性,因为这个表是使用ASP动态构建的。
这没有任何意义。
如果我使用一个包含4列和12行的表,我可以支持相当广泛的模板如:
| --------------- | | --------------- | | ------- | ------- |
| ABC | | | | ABC | |
| --------------- | | ABC | | ------- | |
| DEF | | | | | DEF |
| --------------- | | ------- | ------- | | GHI | |
| GHI | | DEF | GHI | | | |
| --------------- | | ------- | ------- | | ------- | ------- | ...
所以我的问题是:有人可以解释为什么表格没有按预期显示吗?
Hello!
I''m trying to make a sort of online page building system. In order to
do this, I represent my page using a HTML table. One of the most basic
templates would be a page divided in six equally proportioned
rectangles:
<table border="1" cellspacing="0" cellpadding="0" width="200"
height="200">
<tr>
<td colspan="2" rowspan="4">ABC</td>
<td colspan="2" rowspan="4">DEF</td>
</tr>
<tr>
<td colspan="2" rowspan="4">GHI</td>
<td colspan="2" rowspan="4">JKL</td>
</tr>
<tr>
<td colspan="2" rowspan="4">MNO</td>
<td colspan="2" rowspan="4">PQR</td>
</tr>
</table>
I was expecting that this would be displayed as follows:
|-------|-------|
| ABC | DEF |
|-------|-------|
| GHI | JKL |
|-------|-------|
| MNO | PQR |
|-------|-------|
As you can see when you copy-paste the snippet, this is not the case.
Of course not. If you read a guide to HTML to find out what rowspan
and colspan do you''ll find that out. Or go to the spec:
http://www.w3.org/TR/html4/struct/ta...tml#h-11.2.6.1
For example, if the TD containing ABC spans four rows and two columns,
then that means it occupies the first two columns in the first four
rows (TRs) of the table. If it''s occupying the first two columns in
the second row, then GHI is shoved over to the third column of the
second row. Moreover, while every TD in the table is denoted as
spanning four rows, your table doesn''t even HAVE four rows for any of
them to span. It only has three.
I cannot leave the colspan/rowspan attributes out because this table
is dynamically build using ASP.
That makes no sense.
If I use a table with 4 columns and 12
rows, I can support a rather wide range of templates such as:
|---------------| |---------------| |-------|-------|
| ABC | | | | ABC | |
|---------------| | ABC | |-------| |
| DEF | | | | | DEF |
|---------------| |-------|-------| | GHI | |
| GHI | | DEF | GHI | | | |
|---------------| |-------|-------| |-------|-------| ...
So my question is: can anyone explain why the table isn''t being
displayed as expected?
在你学会了行盘和
colspan的工作后,看看你的期望是什么。
-
Harlan Messinger
从我的电子邮件地址中删除第一个点。
Veuillez?ter le premier point de mon adresse de courriel。
See what your expectations are after you''ve learned how rowspan and
colspan work.
--
Harlan Messinger
Remove the first dot from my e-mail address.
Veuillez ?ter le premier point de mon adresse de courriel.
lo******@hotmail.com (Logix)在新闻中写道:2b30e0b5.0408190108.241fe246
@ posting.google.com:
lo******@hotmail.com (Logix) wrote in news:2b30e0b5.0408190108.241fe246
@posting.google.com:
您好!
我正在尝试制作一种在线页面构建系统。为了做到这一点,我使用HTML表来表示我的页面。最多
基本模板之一是分为六个等比例矩形的页面:
< table border =" 1" CELLSPACING = QUOT; 0" CELLPADDING = QUOT; 0" width =" 200"
height =" 200">
< tr>
< td colspan =" 2" rowspan =" 4"> ABC< / td>
< td colspan =" 2" rowspan =" 4"> DEF< / td>
< / tr>
< tr>
< td colspan =" 2" rowspan =" 4"> GHI< / td>
< td colspan =" 2" rowspan =" 4"> JKL< / td>
< / tr>
< tr>
< td colspan =" 2" rowspan =" 4"> MNO< / td>
< td colspan =" 2" rowspan =" 4"> PQR< / td>
< / tr>
< / table>
我原以为这会显示如下:
只是表格的ASCII艺术形象? :D
| ------- | ------- |
| ABC | DEF |
| ------- | ------- |
| GHI | JKL |
| ------- | ------- |
| MNO | PQR |
| ------- | ------- |
正如您在复制粘贴片段时所看到的那样,情况并非如此。
我不能保留colspan / rowspan属性,因为这个表是使用ASP动态构建的。
为什么不能?
如果我使用一个有4列和12行的表,我可以支持相当宽的范围模板如:
| --------------- | | --------------- | | ------- | ------- |
| ABC | | | | ABC | |
| --------------- | | ABC | | ------- | |
| DEF | | | | | DEF |
| --------------- | | ------- | ------- | | GHI | |
| GHI | | DEF | GHI | | | |
| --------------- | | ------- | ------- | | ------- | ------- | ...
模板?人力资源管理?模板为什么?我猜的表格数据!
(Muahaha邪恶的CSS狂热者罢工!)
所以我的问题是:谁能解释为什么桌子不是
按预期显示?
是的。你正在跳过表格行。您需要第二个标记,
第三个和第四个表行:
< table border =" 1" CELLSPACING = QUOT; 0" CELLPADDING = QUOT; 0" width =" 200"
height =" 200">
< tr>
< td colspan =" 2" ; rowspan =" 4"> ABC< / td>
< td colspan =" 2" rowspan =" 4"> DEF< / td>
< / tr>
< tr>< / tr>
< tr>< / tr>
< tr>< / tr>
< tr>
< td列跨度= QUOT; 2英寸rowspan =" 4"> GHI< / td>
< td colspan =" 2" rowspan =" 4"> JKL< / td>
< / tr>
< tr>< / tr>
< tr>< / tr>
< tr>< / tr>
< tr>
< td列跨度= QUOT; 2英寸rowspan =" 4"> MNO< / td>
< td colspan =" 2" rowspan =" 4"> PQR< / td>
< / tr>
< tr>< / tr>
< tr>< / tr>
< tr>< / tr>
< / table>
但是,你_claim_使用动态构建的ASP表。
如果是这样的话,让你的程序变得更聪明,这样就减少了
colspans所以他们有一个共同点,然后
减少了rowpans,所以_they_的公分母一个。
我也读过这个新闻组中的一些帖子说明如上所述使用表来做不良表格技术的症状。所以我想问一下是否有人有其他建议
来完成上述功能。
Hello!
I''m trying to make a sort of online page building system. In order to
do this, I represent my page using a HTML table. One of the most basic templates would be a page divided in six equally proportioned
rectangles:
<table border="1" cellspacing="0" cellpadding="0" width="200"
height="200">
<tr>
<td colspan="2" rowspan="4">ABC</td>
<td colspan="2" rowspan="4">DEF</td>
</tr>
<tr>
<td colspan="2" rowspan="4">GHI</td>
<td colspan="2" rowspan="4">JKL</td>
</tr>
<tr>
<td colspan="2" rowspan="4">MNO</td>
<td colspan="2" rowspan="4">PQR</td>
</tr>
</table>
I was expecting that this would be displayed as follows:
As just an ASCII art image of a table? :D
|-------|-------|
| ABC | DEF |
|-------|-------|
| GHI | JKL |
|-------|-------|
| MNO | PQR |
|-------|-------|
As you can see when you copy-paste the snippet, this is not the case.
I cannot leave the colspan/rowspan attributes out because this table
is dynamically build using ASP.
Why can''t you?
If I use a table with 4 columns and 12
rows, I can support a rather wide range of templates such as:
|---------------| |---------------| |-------|-------|
| ABC | | | | ABC | |
|---------------| | ABC | |-------| |
| DEF | | | | | DEF |
|---------------| |-------|-------| | GHI | |
| GHI | | DEF | GHI | | | |
|---------------| |-------|-------| |-------|-------| ...
Templates? Hrm? Templates for what? Tabular data I presume!
(Muahaha evil CSS zealot strikes out!)
So my question is: can anyone explain why the table isn''t being
displayed as expected?
Yes. You''re skipping table rows. You need markup for the second,
third, and fourth table rows:
<table border="1" cellspacing="0" cellpadding="0" width="200"
height="200">
<tr>
<td colspan="2" rowspan="4">ABC</td>
<td colspan="2" rowspan="4">DEF</td>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr>
<td colspan="2" rowspan="4">GHI</td>
<td colspan="2" rowspan="4">JKL</td>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr>
<td colspan="2" rowspan="4">MNO</td>
<td colspan="2" rowspan="4">PQR</td>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
</table>
However, you _claim_ to be using a dynamically built table with ASP.
If that''s the case, make your program smarter so that it reduces
colspans so that they have a common denominator of one, and then
reduces rowspans so that _they_ have a common denominator of one.
I''ve also read some posts in this newsgroup stating that the use of
tables to do things as described above is "symptomatic of poor table
technique". So I would like to ask if someone has other suggestions to accomplish the features described above.
既然你提到了模板,我假设你正在使用表格
布局。由于表格用于表格数据,因此这不是一个很好用的表格。 CSS以更好的方式完成这个诀窍。
-
如何制作它以便访问者无法调整字体大小:
< http://www.rpi.edu/~hughes/www/wise_guy/unresizable_text.html>
Since you mentioned templates, I assume you are using tables for
layout. Since tables are for tabular data, this isn''t a good use of
tables. CSS does the trick in a much better manner.
--
How to make it so visitors can''t resize your fonts:
<http://www.rpi.edu/~hughes/www/wise_guy/unresizable_text.html>