0

I've got this table, and in this table are 4 columns, like this:

Column1|Column2|Column3|Column4|
data 1  data 2  data 3  data 4

But how do I get it like this?

Column1| data 1
Column2| data 2
Column3| data 3
Column4| data 4

This is my code:

<table>
    <tr>
        <th>Column1</th>
        <th>Column2</th>
        <th>Column3</th>
        <th>Column4</th>
    </tr>
</table>

Any ideas? Is it even possible?

user2551208
  • 55
  • 1
  • 6

5 Answers5

2

Like this:

<table>
    <tr>
        <th>Column1</th>
        <td>Data 1</td>
    </tr>
    <tr>
        <th>Column2</th>
        <td>Data 2</td>
    </tr>
    <tr>
        <th>Column3</th>
        <td>Data 3</td>
    </tr>
    <tr>
        <th>Column4</th>
        <td>Data 4</td>
    </tr>
</table>
scrblnrd3
  • 7,228
  • 9
  • 33
  • 64
0

You put the th in the table rows

<table>
  <tbody>
    <tr>
       <th>Column 1</th>
       <td>Data 1</td>
    </tr>
    <tr>
       <th>Column 2</th>
       <td>Data 2</td>
    </tr>
  </tbody>
</table>
epascarello
  • 204,599
  • 20
  • 195
  • 236
0
<table>
    <tr>
        <th>Column 1</th>
        <td>Data 1</td>
    </tr>
    <tr>
        <th>Column 2</th>
        <td>Data 2</td>
    </tr>
    <tr>
        <th>Column 3</th>
        <td>Data 3</td>
    </tr>
    <tr>
        <th>Column 4</th>
        <td>Data 4</td>
    </tr>
</table>
takendarkk
  • 3,347
  • 8
  • 25
  • 37
0

Maybe scope attribute can help you?

<table>
    <tr scope="row">
        <th>Column1</th>
        <th>Column2</th>
        <th>Column3</th>
        <th>Column4</th>
    </tr>
    <tr>
       <td>Some content</td>
       <td>Some content</td>
       <td>Some content</td>
       <td>Some content</td>
    </tr>
</table>

Also here, you get another solution by CSS.

Community
  • 1
  • 1
Astralian
  • 245
  • 1
  • 6
-1

you can use below pattern But i'll suggest you to use css tables : Page layout, Divs instead of Tables

<table>
    <tr>
       <th>Column1</th><td>data 1</td>
    </tr>
    <tr>
       <th>Column1</th><td>data 1</td>
    </tr>
    <tr>
       <th>Column1</th><td>data 1</td>
    </tr>
    <tr>
       <th>Column1</th><td>data 1</td>
    </tr>
</table>
Community
  • 1
  • 1