Html – Unequal Html textbox and dropdown width with XHTML 1.0 strict

csshtml

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?

Having the following 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>

Best Answer

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

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