user244902
user244902

Reputation: 143

Hot to put html table cells exactly under each other?

I have following html code:

<meta http-equiv="Content-type" content="text/html; charset=utf-8" />

<table border="1" style="width:300px">
  <tr>
    <td>Avaldus</td>
    <td>Staatus</td>
    <td>Kehtivusaeg</td>
  </tr>
  <tr>
    <td>Sõidutoetus<td>
    <td>Arvestatud<td>
    <td>kuni 1. jaanuarini</td>
  </tr>
</table>

When I look it in my browser it looks very bad, I want columns to be exactly under each other, so Sõidutoetus would be under Avaldus and Arvestatud under Staatus etc. But they are not. How could I make it right?

Upvotes: 0

Views: 467

Answers (2)

Suresh Ponnukalai
Suresh Ponnukalai

Reputation: 13978

your code is wrong. You have not properly close the table columns. Use the below code.

 <table border="1" style="width:300px">
  <tr>
    <td>Avaldus</td>
    <td>Staatus</td>
    <td>Kehtivusaeg</td>
  </tr>
  <tr>
      <td>Sõidutoetus</td>
      <td>Arvestatud</td>
    <td>kunijaanuarini</td>
  </tr>
</table>

Upvotes: 0

Quentin
Quentin

Reputation: 943615

You need to use end tags to end your table cells.

The first two cells in the send row have start tags after them instead of end tags.

<td>Sõidutoetus<td> <!-- needs a / -->
<td>Arvestatud<td>  <!-- ditto -->

Alternatively, just omit them. End tags for table cells are optional in HTML.

<td>Sõidutoetus
<td>Arvestatud

Upvotes: 2

Related Questions