How to keep three select tags in a single line?

  • A+
Category:Languages

In this example, I have used three select tags for months dates and years but I need them in a single line. I have tried display: inline-block; but there was no change at all.

<form name="c_month">   <select name="cars">     <option name="o1" value="1">January</option>     <option name="o2" value="2">February</option>     <option name="o3" value="3">March</option>     <option name="o4" value="4">April</option>   </select>   </form></span>   <form name="c_date">   <select name="cars">     <option name="o1" value="1">1</option>     <option name="o2" value="2">2</option>     <option name="o3" value="3">3</option>     <option name="o4" value="4">4</option>   </select>   </form>   <form name="c_year">   <select name="cars">     <option name="o1" value="2018">2018</option>     <option name="o2" value="2017">2017</option>     <option name="o3" value="2016">2016</option>     <option name="o4" value="2015">2015</option>   </select> </form>

 


I'd suggest wrapping all of them inside one form element.

<form>   <select name="cars">     <option name="o1" value="1">January</option>     <option name="o2" value="2">February</option>     <option name="o3" value="3">March</option>     <option name="o4" value="4">April</option>   </select>   <select name="cars">     <option name="o1" value="1">1</option>     <option name="o2" value="2">2</option>     <option name="o3" value="3">3</option>     <option name="o4" value="4">4</option>   </select>   <select name="cars">     <option name="o1" value="2018">2018</option>     <option name="o2" value="2017">2017</option>     <option name="o3" value="2016">2016</option>     <option name="o4" value="2015">2015</option>   </select> </form>

Unless you especially want 3 forms, then I'd suggest adding:

form {     display: inline-block; } 

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: