简单的html页面在Firefox和IE中的呈现方式不同。怎么解决?

时间:2009-11-10 10:04:38

标签: html css

以下是我正在创建的表单的代码。它链接到的CSS代码也在此代码之后添加。问题是它在Firefox和IE中的呈现方式不同。如何稳定它?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Add/Update Political Party</title>
    <link rel="stylesheet" href="../Lib/entryformstyle.css" type="text/css"/>
</head>
<body>
<div id="sectionEntryForm" class="entryForm" style="width:300px">
    <table id="tblEntryForm" cols="2" class="entryFormTable" border="1">
        <tr bgcolor="white">
            <td colspan="2" align="center">Add / Update Political Party</td>
        </tr>
        <tr>
            <td>Party full name:</td>
            <td><input id="inPartyFullName" name="inPartyFullName" accept="text/plain" maxlength="80" class="inputBoxStyle" size="40"></td>
        </tr>
        <tr>
            <td>Party short name (initials):</td>
            <td><input id="inPartyShortName" name="inPartyShortName" accept="text/plain" maxlength="10" class="inputBoxStyle"></td>
        </tr>
        <tr>
            <td>Total members in party:</td>
            <td><input id="inTotalMembers" name="inTotalMembers" accept="text/plain" maxlength="6" class="inputBoxStyle"></td>
        </tr>
        <tr>
            <td>Chairman:</td>
            <td><input id="inChairman" name="inChairman" accept="text/plain" maxlength="80" class="inputBoxStyle"></td>
        </tr>
        <tr>
            <td>Vice-chairman:</td>
            <td><input id="inViceChairman" name="inViceChairman" accept="text/plain" maxlength="80" class="inputBoxStyle"></td>
        </tr>
        <tr>
            <td>Founder:</td>
            <td><input id="inFounder" name="inFounder" accept="text/plain" maxlength="80" class="inputBoxStyle"></td>
        </tr>
        <tr>
            <td>Date formed (dd/MM/yyyy):</td>
            <td><input id="inDateFormed" name="inDateFormed" accept="text/plain" maxlength="10" class="inputBoxStyle"></td>
        </tr>
        <tr>
            <td align="center"><input id="btnMenu" name="btnMenu" type="button" value="Return to Menu"></td>
            <td align="center"><input id="btnClear" name="btnClear" type="button" value="Clear Entries"></td>
            <td align="center"><input id="btnUpdate" name="btnUpdate" type="button" value="Update Record"></td>
        </tr>
    </table>
</div>
</body>
</html>

CSS代码:

div.entryForm
{
    padding: 1px;
    margin: 1px;
    color: black;
    background-color:lightgrey;
}

div.entryFormTable
{
    border:thin;
    border-color:black;
}

input.entryFormColor
{

}

3 个答案:

答案 0 :(得分:1)

答案 1 :(得分:0)

远景:尝试在表格单元格上定义特定宽度,以便IE和FF以相同的大小打开表格单元格。确保它们总计达300px。

答案 2 :(得分:0)

有人建议我也设置表格的背景颜色。将表格的背景颜色设置为DIV的背景颜色,解决了问题。

感谢大家建议各种替代方案。