views:

717

answers:

5
A: 

using a table for layout might help

Ali Kazmi
I'd rather not, its not tabular data, I'm fine with using CSS to fix the issue, just not been able to find a way to do it.
Sam Cogan
+2  A: 

I have tried the following code. This lines up perfectly, when testing in IE7.

<input type="text">

<select>
  <option>option1</option>
  <option>option2</option>
</select>

My guess is that some CSS styling from parent elements (body, form, parent classes) gets applied to one or both of these elements, but without seeing the source code, this is hard to judge.

Daan
OK, thanks, I will try removing any styling and see if I can find out which one is causing it. Looking in firebug the only styles that seem to be applied are some font styles and setting the border and padding to 0.
Sam Cogan
Padding could easily be the problem in this case...
Mladen Mihajlovic
+3  A: 
Ola Tuvesson
Yeah, I am actually using this. Thought this might be involved in the issue, but maybe not
Sam Cogan
Your HTML does render the way you want when I test it - there must be something elsewhere in your CSS that causes the misalignment!
Ola Tuvesson
If you use the "inspector" in Firebug you can compare the CSS that gets applied to each element; that will make it easier to see where the problem lies.
Ola Tuvesson
A: 

I'd suggest putting your form in some surrounding markup. I commonly use definition lists, so the markup would be something like

<dl>
    <dt>
     <label for="ctl00_main_primaryEmail" id="ctl00_main_primaryEmailLabel">Primary Email: </label>
    </dt>
    <dd>
     <input name="ctl00$main$primaryEmail" type="text" id="ctl00_main_primaryEmail" />
    </dd>
    <dt style="display: none;">
     <label for="ctl00_main_acceptedDomainsDropDownList">Accepted Domains</label>
    </dt>
    <dd>
     <select name="ctl00$main$acceptedDomainsDropDownList" id="ctl00_main_acceptedDomainsDropDownList">
      <option value="exchange.samcogan.com">exchange.samcogan.com</option>
      <option value="doamin1.com">domain1.com</option>
      <option value="domain2.com">domain2.com</option>
      <option value="domain3.com">domain3.com</option>
     </select>
    </dt>
</dl>

Then you can float/position the dt and dd elements to appear in a single horizontal row.

This approach, whether you use a dl, ul or other, gives better positioning in general.

David Caunt
+2  A: 

It turns out this issue was CSS related. It was a border setting for the select element buried deep in the IE only stylesheet of the Blueprint Library, hence not showing up in firebug. For anyone else that comes across it, its this CSS for the select element

margin : 0.5em 0px
Sam Cogan