IE9.0和colgroup / colspam问题 [英] IE9.0 and colgroup / colspam issue

查看:159
本文介绍了IE9.0和colgroup / colspam问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IE 9.0无法正确呈现HTML,我没有想法......
请帮忙。
我无法更改<!DOCTYPE html>。任何想法?
谢谢。

IE 9.0 does not render following HTML correctly and I am out of ideas...... Please help. I CANNOT change "< !DOCTYPE html >". any ideas ? Thanks.

<!DOCTYPE html>
<html lang="en">
<body>
<table style="table-layout:fixed;" width="100%" border="1">
    <colgroup span="120">
    </colgroup>
    <tbody>
        <tr>
            <td colspan="120">AAAAAAAAAAAAAAAAAAAAAA</td>
        </tr>
        <tr>
            <td colspan="15">aa</td>
            <td colspan="15">ss</td>
            <td colspan="90">dd</td>
        </tr>
        <tr>
            <td colspan="120">zzzzzzzz</td>
        </tr>
    </tbody>
</table>


推荐答案

标记违反HTML表模式,因为 W3C标记验证器会告诉您,以某种神秘的方式。 colspan 属性指定单元格跨越的表列数。当只有3列时,你不能跨越120列。

The markup violates the HTML table mode, as the W3C Markup Validator would tell you, in its somewhat cryptic way. The colspan attribute specifies the number of table columns that a cell spans. You cannot span 120 columns when there are only 3 columns.

在我看来,你真正想要的是划分列之间的可用宽度,以便关系是15:15:90。将其简化为1:1:6,然后将它们变为百分比:

It seems to me that what you really want is to divide the available width between the columns so that the relations are 15 : 15 : 90. Simplify this to 1 : 1 : 6 and then turn them to percentages:

<table style="table-layout:fixed;" width="100%" border="1">
     <col width="12.5%">
     <col width="12.5%">
     <col width="75%">
    <tbody>
        <tr>
            <td colspan="3">AAAAAAAAAAAAAAAAAAAAAA</td>
        </tr>
        <tr>
            <td>aa</td>
            <td>ss</td>
            <td>dd</td>
        </tr>
        <tr>
            <td colspan="3">zzzzzzzz</td>
        </tr>
    </tbody>
</table>

使用固定布局,在处理第一行时确定列的宽度。因此,宽度需要在 col 元素中设置。否则,浏览器在处理第一行时,将没有任何宽度要求,因此,根据规范,它将在列之间均匀地划分总空间。

Using fixed layout, the widths of columns are determined when the first row is processed. Therefore, the widths need to be set in col elements. Otherwise, the browser, when processing the first row, would not have any width requirements, so it would, by the specs, divide the total space evenly between the columns.

这篇关于IE9.0和colgroup / colspam问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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