html - How to get an input field to cover two td's -


i'm trying create basic form. have table 3 td's. in second row input span 2 td's. unfortunately cannot life of me input field cover 2 td's. have tried colspan="2" in td tag didn't seem work.

    <table id="info_table">             <tr>                 <td >name:</td>                 <td><input type="text" name="first_name" autofocus placeholder="first name"></td>                 <td><input type="text" name="last_name" placeholder="last name"></td>             </tr>              <tr>                  <td>email:</td>                 <td id="email" colspan="2"><input type="email" name="email" placeholder="ex. example@example.ca"></td>             </tr>     </table> 

you'll need manually set input field's width 100%, this:

<td id="email" colspan="2"> <input type="email" name="email" placeholder="ex. example@example.ca" style="width: 100%"> </td> 

here's jsfiddle.

manually setting width 100% ensures takes space can, rather defaulting 1 column.

if have separate css file, you'll want put width: 100% in appropriate location in there (within input{} or similar) keep separate html code.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -