I have a label and input inside of a div that is positioned using a left float. There are three divs side by side using the same rules. The inputs use a background image to style them up a bit and I styled them using tips from a SitePoint book. They are not floated, just in the flow of the document relative to the floated div. The labels, however, ARE floated. It renders correctly in IE8, Firefox 3.5, and Safari 4. My problem is that for the two inputs included in these three divs, there looks to be some left-margin included when rendered in IE7. When i put the border around the inputs it doesn’t wrap this extra space so that’s how I know it must either be some margin for the input, a padding of the containing div, or something strange I’m not familiar with.
Here is Firebug’s relevant info on one of the inputs:
input.zip {
background-image:url("https://perksforwork.com/business/new/images/txt70.png");
background-repeat:no-repeat;
border:medium none;
font-family:Arial,sans-serif;
font-size:16px;
padding:9px 10px;
width:50px;
}
css_index.css (line 588)
Inherited from div.zsrch
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
font-size:100%;
}
reset.css (line 4)
Inherited from form.perksearch search
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
font-size:100%;
}
reset.css (line 4)
Inherited from div#white-content
#white-content {
color:#555555;
}
css_index.css (line 388)
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
font-size:100%;
}
reset.css (line 4)
Inherited from div#outer
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
font-size:100%;
}
reset.css (line 4)
Inherited from body
body {
font-family:Georgia,serif;
}
css_index.css (line 9)
and CSS for the labels:
.perksearch label {
clear:none;
margin-bottom:3px;
text-align:center;
width:100%;
}
css_index.css (line 326)
label {
color:#555555;
float:left;
font-size:16px;
padding-top:7px;
width:70px;
}
css_index.css (line 28)
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
background:none repeat scroll 0 0 transparent;
border:0 none;
font-size:100%;
margin:0;
min-height:0;
outline:0 none;
padding:0;
vertical-align:baseline;
}
and then the containing div for both:
.perksearch div {
max-width:none;
}
css_search.css (line 55)
.perksearch div {
border:1px dotted black;
float:left;
margin:0 10px;
max-width:302px;
}
css_index.css (line 318)
.zsrch {
width:72px;
}
css_index.css (line 333)
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
background:none repeat scroll 0 0 transparent;
border:0 none;
font-size:100%;
margin:0;
min-height:0;
outline:0 none;
padding:0;
vertical-align:baseline;
}
I’ve attached a picture of what it looks like with dotted borders applied to the containing divs. I just can’t figure this out! :mad:
note: maybe its helpful to know that these and other elements are all contained inside a form element that I have also floated left with no margin and padding: 0 65px.
note2: I usually try to do things without floats and absolute positioning first but with labels and inputs it has proven difficult for me. It’s the domino effect: float one thing, you usually have to float everything else inside it or position it absolutely. I also refuse to resort to tables.