2

I'm wondering if possible to arrange two checkbox input fields vertically in same td cell? Below is example, there both of input fields are next to each other.

<table>
  <tr>
      <td>
           <input type="number" />
           <input type="checkbox" name="ck1" id="ck1">A
           <input type="checkbox" name="ck2" id="ck2">B
      </td>
  </tr>
</table>
Koby Douek
  • 16,156
  • 19
  • 74
  • 103
espresso_coffee
  • 5,980
  • 11
  • 83
  • 193
  • Possible duplicate of [Make new lines in CSS in form for each label](https://stackoverflow.com/questions/25392197/make-new-lines-in-css-in-form-for-each-label) – showdev Aug 25 '17 at 18:38
  • 1
    @showdev That's not remotely a duplicate of that – Koby Douek Aug 25 '17 at 18:40
  • 1
    @showdev OP is asking about a `td` element, that question is about a form, and see the given answers there – Koby Douek Aug 25 '17 at 18:41
  • @KobyDouek In my opinion, `` vs `
    ` is irrelevant here. The essence of the question is about putting inputs on separate lines, for which solutions appear in that post. Incidentally, your solution can be found there, too.
    – showdev Aug 25 '17 at 18:42
  • @showdev OP there was asking about CSS, without using `
    `, which is the obvious answer here
    – Koby Douek Aug 25 '17 at 18:43
  • @KobyDouek Since there are many ways to achieve this, there is nothing "obvious" about any one particular method being "the answer". In my opinion, CSS is a more effective solution than `
    `. If you don't agree, don't vote for the duplicate.
    – showdev Aug 25 '17 at 18:46

1 Answers1

3

How about using a simple <br> with using text-align:right on the <td>?

<table>
  <tr>
    <td style='text-align:right'>
      <input type="number">
      <input type="checkbox" name="ck1" id="ck1">A<br>
      <input type="checkbox" name="ck2" id="ck2">B
    </td>
  </tr>
</table>
Koby Douek
  • 16,156
  • 19
  • 74
  • 103