doominabox1
doominabox1

Reputation: 458

How to align text and select box horizontally?

This code produces

<table>
    <tr>
        <td NOWRAP><?php echo "Employee Birthdays for " . $monthName; ?></td>
        <td width="100%"></td>
        <td>Browse:</td>
        <td valign="middle">
            <form method="get">
                <select type="submit" name="mo" onchange="this.form.submit()">
                    <option value="01">January</option>
                    <option value="02">February</option>
                    <option value="03">March</option>
                    <option value="04">April</option>
                    <option value="05">May</option>
                    <option value="06">June</option>
                    <option value="07">July</option>
                    <option value="08">August</option>
                    <option value="09">September</option>
                    <option value="10">October</option>
                    <option value="11">November</option>
                    <option value="12">December</option>
                </select>
            </form>
        </td>
    </tr>
</table>

This picture:enter image description here

How can I get the month selector box to actually line up with "Browse:"?

Edit: I should note that this works in IE, but in Chrome it's misaligned.

Upvotes: 0

Views: 79

Answers (2)

mkawa
mkawa

Reputation: 203

add any one code in your css

form{
  margin-bottom: 0em;
}

or

form{
  margin-bottom: 0em !important;
}

Upvotes: 1

Marc Audet
Marc Audet

Reputation: 46785

You have some other CSS styles affecting the code, it seems to work fine below.

I checked this both in Firefox and Chrome, latest versions.

td {
  border: 1px dotted gray;
  height: 100px; /* for demo only */
}
form {
  border: 1px dashed blue;
}
<table>
  <tr>
    <td nowrap>Employee Birthdays for October</td>
    <td width="100%"></td>
    <td>Browse:</td>
    <td valign="middle">
      <form method="get">
        <select type="submit" name="mo" onchange="this.form.submit()">
          <option value="01">January</option>
          <option value="02">February</option>
          <option value="03">March</option>
          <option value="04">April</option>
          <option value="05">May</option>
          <option value="06">June</option>
          <option value="07">July</option>
          <option value="08">August</option>
          <option value="09">September</option>
          <option value="10">October</option>
          <option value="11">November</option>
          <option value="12">December</option>
        </select>
      </form>
    </td>
  </tr>
</table>

Upvotes: 2

Related Questions