css - aligning a checbox next to a <td> in html -
i have basic css/html question using html/css. thought basic , obvious, not working intended.
in basic image, want labels to right of expertise
(creating registration page user selects his/her expertise)
i believe basically
<tr> <td>expertise</td> <input type="checkbox" style="vertical-align: left; margin: 12px;"> label </input><br> <input type="checkbox" style="vertical-align: left; margin: 12px;"> label 2 </input> </tr>
however not working intended.
first of markup invalid, table
element can have elements meant table
child elements i.e tbody, thead, th, tr, td
etc, , no other elements, instead can place checkboxes inside td
secondly input tag doesn't have explicit closing tag, need self close it, else leave without closing <br>
third - use label
tag instead of having stray text besides checkbox
the right way
<table> <tr> <td class="valign"> expertise </td> <td> <input type="checkbox" style="vertical-align: left; margin: 12px;" /> <label>label</label><br /> <input type="checkbox" style="vertical-align: left; margin: 12px;" /> <label>labe2</label> </td> </tr> </table>
css
.valign { vertical-align: top; }
Comments
Post a Comment