开发者

Quirks mode table and text alignment issues

I have the following html code snippet :-

<html>
<head>
    <style>
        body ul
        {
            margin: 0px;
            border: 1px solid black;
            padding: 0px;
            list-style-type: none;
        }
        ul li {
        display: inline;
            padding: 0px;
            margin: 0px;
            border: 1px solid red;
        }
        table
        {
            display: inline;
            margin: 0px;
            padding: 0px;
            border:1px solid green;

        }

    </style>
</head>
<body>
<ul>
        <li>Item1</li>
        <li>Item2</li>
        <li>
            <table>
                <tbody>
                    <tr>
                        <td>Item3</td>
                        <td>Stars</td>
                    </tr>
                </tbody>
            </table>
        </li>
    </ul>

</body>
    </html>

I have to render this code in quirks mode(Due to an Iframe in the page, to render it properly I found that Quirks mode suits the best). I see that IE8 displays the code as:

Quirks mode table and text alignment issues

(source: ggpht.c开发者_如何学运维om)

Table not aligned with the other list items. Whereas mozilla displays it as :-

Quirks mode table and text alignment issues

(source: ggpht.com)

Here the table is aligned but the text is not.

What is going wrong here? How do I fix this across browsers


Insist on quirks mode? OK.

It looks like the td within the table has padding that causes it to render like that in IE.

Try removing padding+margin on all elements after table.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜