Wednesday, November 18, 2009

Align Form Select with Image Submit Button Using CSS

I pulled my hair out over this one for about 45 minutes tonight. There's a trick out there for getting your form submit image to line up with your text input box, but it wasn't working when using a select form element. The process is the same, but rather than using the css:

  • vertical-align: text-top;
Use one of these:
  • vertical-align: top;
  • vertical-align: bottom;
Code Sample:

<form action="pdfcall.cfm">
<select name="quarterly" style="vertical-align: top;">
<option value="0">-- Select a Quarter --</option>
<option value="#">Q1 2009</option>
<option value="#">Q4 2008</option>
<option value="#">Q3 2008</option>
<option value="#">Q2 2008</option>
</select>
<input type="image" src="images/submit.jpg" style="margin-left: 10px;" />
</form>

1 comment: