Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

The table width isnt reducing , HTML

I inserted the code below in an effort to create a table on my enfold-powered wordpress site. Ultimately, the table appeared, but the width is not getting reduced. The code i supply below was provided to me by w3-schools...

<br> <table width="200"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </table>

No matter how much i alter the width, it remains... a full length table. I want a cutesy small little wee table.

-Elliot help appreciated

Tiffany McAllister
Tiffany McAllister
25,806 Points

You need to wrap your code in a table element:

<table>
  <th>Month</th>
  <th>Savings</th>

  <td>January</td>
  <td>$100</td>

  <td>February</td>
  <td>$80</td>
</table>

And give the table element a width.

2 Answers

I added the edits you mentioned and it still didnt work; check this out --> here is the code i used on 2nd try

<body> <table width="400">

<table border=”1” cellpadding=”5” cellspacing=”5”> <tr> <thead> <th> These are my vegetables</th> <th valign=middle> Fruits</th> </tr> </thead> <tfoot> <tr> <td colspan=”2” align=”center”> Thanks</td> <td> me</td> </tr> </foot> <tr> <td> Or</td> </tr> <tr> <td> Apples</td> </tr> </table> </body>

Tiffany McAllister
Tiffany McAllister
25,806 Points

My apologies. The code is also missing row tags:

<table>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>

  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>

  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>

What size are you trying to make the table?

Friend, I added your code; should i place the "width" element inside of the first table element, like this?

<table width="100">

following this tag, is the rest of your stuff. If i am incorrect, please tell me where i should place the width element