• Hi, I’m new to all of this, but understand a little html. I’m having trouble putting borders into my tables. If I use rules=”all” (or any other value”), the cellspacing=”value” and cellpadding=”value” (I’ve tried different values all the way up to 50) commands are ignored, my table scrunches together. How do I solve this?

    Example of my code:

    `<span style=”text-decoration: underline;”>Informatieavonden in 2009</span>:
    <table border=”1″ cellspacing=”value” cellpadding=”value” rules=”all”>
    <tbody style=”font-size:75%”>
    <tr>
    <td width=”50″>Gem.:</td>
    <td colspan=”3″>Datum:</td>
    <td width=”80″>Tijd:</td>
    <td width=”70″>Locatie:</td>
    </tr>
    <tr>
    <tr>
    <td>De Rijp</td>
    <td width=”20″>do</td>
    <td width=”20″></td>
    <td width=”30″>mei</td>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td>ma</td>
    <td>29</td>
    <td>jun</td>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td>Edam</td>
    <td>do</td>
    <td>23</td>
    <td>apr</td>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td>di</td>
    <td>1</td>
    <td>sep</td>
    <td>20.00-22.00 u</td>
    <td>De Singel</td>
    </tr>
    <tr>
    <td>Velsen</td>
    <td>di</td>
    <td>16</td>
    <td>juni</td>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td>ma</td>
    <td>31</td>
    <td>aug</td>
    <td>19.30-21.30 u</td>
    <td>Het Mosterdzaadje</td>
    </tr>
    <tr>
    <td>Westzaan</td>
    <td>wo</td>
    <td>17</td>
    <td>juni</td>
    <td>19.30-22.00 u</td>
    <td>De Kwaker</td>
    </tr>
    </tbody></table>

Viewing 4 replies - 1 through 4 (of 4 total)
  • I opened your code in a browser and I see what you mean, I think. You need to delete the <tr> after your first row, you have an extra one.

    Or you can just copy this:

    <table border="1" cellspacing="value" cellpadding="value" rules="all">
    <tbody style="font-size:75%">
    <tr>
    <td width="50">Gem.:</td>
    <td colspan="3">Datum:</td>
    <td width="80">Tijd:</td>
    <td width="70">Locatie:</td>
    </tr>
    <tr>
    <td>De Rijp</td>
    <td width="20">do</td>
    <td width="20"></td>
    <td width="30">mei</td>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td>ma</td>
    <td>29</td>
    <td>jun</td>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td>Edam</td>
    <td>do</td>
    <td>23</td>
    <td>apr</td>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td>di</td>
    <td>1</td>
    <td>sep</td>
    <td>20.00-22.00 u</td>
    <td>De Singel</td>
    </tr>
    <tr>
    <td>Velsen</td>
    <td>di</td>
    <td>16</td>
    <td>juni</td>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td>ma</td>
    <td>31</td>
    <td>aug</td>
    <td>19.30-21.30 u</td>
    <td>Het Mosterdzaadje</td>
    </tr>
    <tr>
    <td>Westzaan</td>
    <td>wo</td>
    <td>17</td>
    <td>juni</td>
    <td>19.30-22.00 u</td>
    <td>De Kwaker</td>
    </tr>
    </tbody></table>

    Thread Starter boofwei

    (@boofwei)

    Thanks for your fast response! I couldn’t find the extra <tr>, but I copied your code in. I still have the problem. I’ll check with the other sources you mention, thanks.

    But what I’m trying to do is make a table with four columns with a fixed with. Without borders, I can control cellspacing and cellpadding. But then, of course, I have a table with content floating around in free space.
    However, as soon as I put borders in, such as with rules="all", the column widths shrink to fit on whatever the largest entry is in the table. So I have borders around the cells, but the content is jammed up against the sides of the cells. No matter what value I set for cellspacing or cellpadding, the column width stays minimalized.

    … hmm, I normally work on a Mac (Firefox), but I’m sitting on a PC at the moment, and I notice here, that the cellspacing and cellpadding work, and rules doesn’t.

    There is definitely some kind of conflict between cellspacing and cellpadding with rules.

    You should use CSS to style your table. I think it’s easier than what you are doing. So if you want to change your cell padding just add this below to your css style sheet:

    td {
    	padding-left:10px;
    	padding-right:10px;
    }

    You can also change the cell spacing by doing the same thing, but instead using the “margin-left” (or right, top, bottom).

    I’m sorry if you already know this, or if it’s totally not what you needed to know.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Table borders and column widths’ is closed to new replies.