António Cabral
António Cabral

Reputation: 179

HTML table column with ghost column

I'm having a werid problem making a super simple table without any css mods. The code is the following:

      <table>
         <tr>
            <th>ID</th>
            <th>Country</th>
            <th>Count</th>
         </tr>
         <tr>
            <td>2<td>
            <td>ARGENTINA<td>
            <td>7379<td>
         </tr>
         <tr>
            <td>3<td>
            <td>CHILE<td>
            <td>6543<td>
         </tr>
         <tr>
            <td>4<td>
            <td>EGYPT<td>
            <td>6512<td>
         </tr>
      </table>

I'm getting crasy in trying to find what's wrong in this super simple code about why is it that the table header's columns refuse to align with its respective values? It seems that there's an extra ghost column being created. Can anyone explain, please?

Upvotes: 0

Views: 1774

Answers (2)

Kevin Pimentel
Kevin Pimentel

Reputation: 1916

Your doesn't have a closing tag.

Try this:

<table>
     <tr>
        <th>ID</th>
        <th>Country</th>
        <th>Count</th>
     </tr>
     <tr>
        <td>2</td>
        <td>ARGENTINA</td>
        <td>7379</td>
     </tr>
     <tr>
        <td>3</td>
        <td>CHILE</td>
        <td>6543</td>
     </tr>
     <tr>
        <td>4</td>
        <td>EGYPT</td>
        <td>6512</td>
     </tr>
  </table>

Then it looks like it tries to create closing tags for each... And as a result you are ending up with weird extra columns.

Upvotes: 0

CubeRoot
CubeRoot

Reputation: 562

Your lines are missing the closing . You have where the closing tags should be.

<table>
         <tr>
            <th>ID</th>
            <th>Country</th>
            <th>Count</th>
         </tr>
         <tr>
            <td>2</td>
            <td>ARGENTINA</td>
            <td>7379</td>
         </tr>
         <tr>
            <td>3</td>
            <td>CHILE</td>
            <td>6543</td>
         </tr>
         <tr>
            <td>4</td>
            <td>EGYPT</td>
            <td>6512</td>
         </tr>
      </table>

Upvotes: 3

Related Questions