htmlcssdotcms

Force selection options to one line


<select id="Semester">
  <option value="Fall">Fall</option>
  <option value="Spring">Spring</option>
  <option value="Summer">Summer</option>
</select>
<select id="Year">
  <option value="2015">2015</option>
  <option value="2016">2016</option>
  <option value="2017">2017</option>
</select>
<p>
  <input class="submit" value="Submit" type="submit" />
</p>

I have this code, which, on StackOverflow is on one line (except for the button). On our CMS, however, each select element shows up on a different line like this:

enter image description here

What can I do to force these all on to one line?


Solution

  • Add display: inline-block to all your elements to make them display in one line:

    <select id="Semester" style="display: inline-block;">
      <option value="Fall">Fall</option>
      <option value="Spring">Spring</option>
      <option value="Summer">Summer</option>
    </select>
    <select id="Year" style="display: inline-block;">
      <option value="2015">2015</option>
      <option value="2016">2016</option>
      <option value="2017">2017</option>
    </select>
    <p style="display: inline-block;">
      <input class="submit" value="Submit" type="submit" />
    </p>