Forum Moderators: not2easy

Message Too Old, No Replies

spacing of form fields

         

luoifong

6:55 pm on Apr 26, 2004 (gmt 0)

10+ Year Member



I have the following html and css, and am having a lot of trouble getting the form fields to place correctly on the bar. In Win/IE5.5 it pushes the gray bar (searchUtilityWrap) down so that it is overlapping the background (shadow). In Mac/Safari it pushes the text field down so that it is falling off the gray bar (searchUtilityWrap)...Any suggestions for how to place the form fields on the bar so that it is uniform in most current browsers?


<div id="searchUtility">
<div id="searchUtilityWrap"> <!-- Utility Bar -->
<div class="floatLeft" style="text-align: left; margin: 0; margin-left: 4px;">
<form style="margin: 0; padding: 0;" action="/search/search.php" method="get">
<input type="hidden" name="result_page" value="/search/search.php" />
<input style="display: inline; margin: 0; margin-bottom: 3px;" type="text" class="phpdiginputtext" size="15" maxlength="50" name="query_string" value="" />
<input style="display: inline; margin: 0; margin-top: 3px;" type="image" name="search" alt="Search" value="Search" id="searchButtonImg" src="/images/global/btn_site_search.jpg" />
</form>
</div>
<div class="floatRight">
<!-- some stuff here --></div>
</div>
</div>

The CSS code


body div#searchUtility {
width: 100%;
height: 38px;
background-color: #aaaaaa;
background-image: url(/images/global/shadow_header.jpg);
background-position: bottom left;
background-repeat: repeat-x;
}

div#searchUtility div#searchUtilityWrap {
text-align: left;
width: 760px;
margin-top: 0;
margin-bottom: 0;
margin-left: auto;
margin-right: auto;
background-color: #aaaaaa;
color: #000000;
}

.floatLeft {
float: left;
}

Thanks for any advice!

DrDoc

5:01 pm on Apr 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



First, I would advise against using a set height for the searchUtility div. Form elements have different sizes in different browsers, and on different OSs. Maybe padding/margin added to the searchUtilityWrap element would work better?

Also, the form element itself has margins that differ between browsers. Add this to your style sheet:

form {
margin: 0;
}