不等的Html文本框和下拉宽度与XHTML 1.0严格 [英] Unequal Html textbox and dropdown width with XHTML 1.0 strict

查看:99
本文介绍了不等的Html文本框和下拉宽度与XHTML 1.0严格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图有两个输入(一个文本框,一个下拉)具有相同的宽度。
您可以通过css设置宽度,但由于某种原因,选择框总是小几个像素。
这似乎只发生在xhtml 1.0 strict doctype
任何关于原因/工作的建议/想法?

I'm trying to have two inputs (one textbox, one drop down) to have the same width. You can set the width through css, but for some reason, the select box is always a few pixels smaller. It seems this only happens with the xhtml 1.0 strict doctype Any suggestions/ideas about the reason/work around?

有以下HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
    <style>
        .searchInput{
            width: 1000px;
            overflow: hidden;
        }
    </style>
</head>
<body>
    <form action="theAction" method="post" class="searchForm" >
        <fieldset>
            <legend>Search</legend>            
            <p>
                <!--<label for="name">Product name</label>-->
                <input class="searchInput" type="text" name="name" id="name" value="" />
            </p>
            <p>
                <!--<label for="ml2">Product Group</label>-->
                <select class="searchInput" name="ml2" id="ml2">
                    <option value="158">INDUSTRIAL PRIMERS/FILLERS</option>
                    <option value="168">CV CLEAR COATS</option>
                    <option value="171">CV PRIMERS/FILLERS</option>
                    <option value="" selected="selected">All</option>
                </select>
            </p>
            <input type="submit"  class="search"  value="Show"  name="Show"  id="Show"  />
            <input type="reset" value="Reset" name="reset" id="reset" class="reset"/>
        </fieldset>
    </form>
</body
</html>


推荐答案

您可以尝试重置边距,看看是否有帮助:

You could try resetting the margins, padding and borders to see if that helps:

.searchInput {
    margin:0;
    padding:0;
    border-width:1px;
    width:1000px;
}

这篇关于不等的Html文本框和下拉宽度与XHTML 1.0严格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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