Table headers in the wrong place


#1

Hello, I’m new to Code academy, and yes, I’m already stuck on something, related to tables.

Along with the exercises from ''Learn HTML: Tables" I have made this code:

Company name Number of Items to Ship Next Action
Adam's Greenworks Davie's Burgers Baker's Bike Shop Miss Sally's Southern Summit Resort Rentals Strike Fitness
14 2 3 4 4 1
Package Items Send Invoice Send Invoice Ship Ship Enter Order

Now the problem is that the headers “Company name”, “Number of Items” and “Ship Next Action” are on top of the first three columns. They are supposed to be on the left so they align with their correct row.
Can anyone explain to me how I can do this?

Thanks in advance,

Floris van Eijk


#2

Hello, try putting 3 empty <td></td> tags before the Company name’s td tag.

edit: or 3 <th></th> tags if you are using these.


#3

Thanks for the quick response.

It did not work though. It just gives me either 3 blank or 3 blue cells depending on whether I use td or th tags.

Instead of above the first 3 columns I want to move the titles to the first 3 rows, but I still can’t get it to work.

Verzonden vanaf mijn Samsung Galaxy-smartphone.

-------- Oorspronkelijk bericht --------


#4

Hey again, try removing the table head and moving each one of your <th></th> tags to the table row you want it to be in, like this:

<table>
<tbody>
      <tr>
          <th>Company name</th>
          <td>Adam's Greenworks</td>
          <td>Davie's Burgers</td>
          <td>Baker's Bike Shop</td>
          <td>Miss Sally's Southern</td>
          <td>Summit Resort Rentals</td>
          <td>Strike Fitness</td>
      </tr>
      <tr>
          <th>Number of Items to Ship</th>
          <td>14</td>
          <td>2</td>
          <td>3</td>
          <td>4</td>
          <td>4</td>
          <td>1</td>
      </tr>
      <tr>
          <th>Next Action</th> 
          <td>Package Items</td>
          <td>Send Invoice</td>
          <td>Send Invoice</td>
          <td>Ship</td>
          <td>Ship</td>
          <td>Enter Order</td>
      </tr>
   </tbody>    
</table>

#5

Hey, it worked! Though, the table headings are not as obvious as headers anymore since they arent within tags, they are at least in the right place now. Thanks!

Verzonden vanaf mijn Samsung Galaxy-smartphone.

-------- Oorspronkelijk bericht --------


#6

No problem!

Though, the table headings are not as obvious as headers anymore since they arent within tags

Try giving them a custom style to make them look more obvious, I hope that I helped.


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.