IE6表单/ div浮动问题

时间:2010-07-14 15:07:50

标签: css internet-explorer internet-explorer-6 css-float

对IE6有一些讨厌的问题,并阅读我的div表单布局,html:

<form id="brochureForm" name="brochureForm" action="/how-it-works/request-a-brochure/" method="post">
        <div class="row">
            <div class="label">
                <label for="szName">Name</label>
            </div>
            <div class="field">
                <input type="text" name="szName" id="szName" value="#form.szName#" />
            </div>
            <div class="clear"></div>
        </div>
        <div class="row">
            <div class="label">
                <label for="szCompanyName">Company Name</label>
            </div>
            <div class="field">
                <input type="text" name="szCompanyName" id="szCompanyName" value="#form.szCompanyName#" />
            </div>
            <div class="clear"></div>
        </div>
        <div class="row">
            <div class="label">
                <label for="szAddress">Address</label>
            </div>
            <div class="field">
                <input type="text" name="szAddress" id="szAddress" value="#form.szAddress#" />
            </div>
            <div class="clear"></div>
        </div>
        <div class="row">
            <div class="label">
                <label for="szTown">Town/City</label>
            </div>
            <div class="field">
                <input type="text" name="szTown" id="szTown" value="#form.szTown#" />
            </div>
            <div class="clear"></div>
        </div>
        <div class="row">
            <div class="label">
                <label for="szPostcode">Postcode</label>
            </div>
            <div class="field">
                <input type="text" name="szPostcode" id="szPostcode" value="#form.szPostcode#" />
            </div>
            <div class="clear"></div>
        </div>
        <div class="row">
            <div class="label">
                <label for="szTelephone">Tel</label>
            </div>
            <div class="field">
                <input type="text" name="szTelephone" id="szTelephone" value="#form.szTelephone#" />
            </div>
            <div class="clear"></div>
        </div>
        <div class="row">
            <div class="label">
                <label for="szEmail">E-mail</label>
            </div>
            <div class="field">
                <input type="text" name="szEmail" id="szEmail" value="#form.szEmail#" />
            </div>
            <div class="clear"></div>
        </div>
        <div class="submitrow">
            <input type="image" name="szSubmit" id="szSubmit" src="/images/form/submit.gif" class="submitRO" />
        </div>
    </form>

然后是CSS:

.row {width:314px;margin:0 0 8px 0;}
.row .label {width:103px;padding:3px 16px 0 0;float:left;text-align:right;}
.row .field {width:195px;float:left;}
.submitrow {width:314px;text-align:right;padding:3px 0 0 0;}

在IE8 / 7,Firefox等中正常工作

2 个答案:

答案 0 :(得分:1)

另外,作为处理IE6的经验法则,尝试将display:inline添加到浮动div中

答案 1 :(得分:0)

IE6有时候没有获得边距和填充权。尽量减少几个像素。