Colspan所有栏目 [英] Colspan all columns

查看:147
本文介绍了Colspan所有栏目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何指定一个 td 标签应该跨越所有列(当表格中列的确切数量将变为/难以确定何时呈现HTML )? w3schools 提及您可以使用 colspan =0,但并未明确说明哪些浏览器支持该值(IE 6在我们的列表中支持)。



编辑:似乎将 colspan 设置为大于您可能具有的理论列数的值,但如果您将 table-layout 设置为 fixed ,它将不起作用。对 colspan 使用大量自动布局有什么缺点?我有IE 7.0,Firefox 3.0和Chrome 1.0 $ / $>

TD中的colspan =0属性不跨越上述任何浏览器中的所有TD

>

也许不推荐作为适当的标记练习,但如果您给出更高的colspan值,其他行中的列,那么TD将跨越所有列。



当table-layout CSS属性设置为fixed时,这不起作用。



再一次,这不是一个完美的解决方案,但当table-layout CSS属性为自动时,似乎可以在上述3个浏览器版本中运行。希望这有助于。


How can I specify a td tag should span all columns (when the exact amount of columns in the table will be variable/difficult to determine when the HTML is being rendered)? w3schools mentions you can use colspan="0", but it doesn't say exactly what browsers support that value (IE 6 is in our list to support).

Edit: It appears that setting colspan to a value greater than the theoretical amount of columns you may have will work, but it will not work if you have table-layout set to fixed. Are there any disadvantages to using an automatic layout with a large number for colspan? Is there a more correct way of doing this?

解决方案

I have IE 7.0, Firefox 3.0 and Chrome 1.0

The colspan="0" attribute in a TD is NOT spanning across all TDs in any of the above browsers.

Maybe not recommended as proper markup practice, but if you give a higher colspan value than the total possible no. of columns in other rows, then the TD would span all the columns.

This does NOT work when the table-layout CSS property is set to fixed.

Once again, this is not the perfect solution but seems to work in the above mentioned 3 browser versions when the table-layout CSS property is automatic. Hope this helps.

这篇关于Colspan所有栏目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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