Search code examples
htmlcsshtml-helpertumblrhtml-table

Table and column html


I'm using a theme that has a really nice grid-like effect. The normal amount of td's is 5. But for some sections I only need two, and for others I need more. I'd like to be able to have them all the same size, because whats happening is when I put the proper amount that I require, it will sometimes stretch the boxes too big or too small. Here's the CSS, and if you need anything else, just let me know.

body {background-color:#cccccc; color:#000000; font:16px Arial, sans-serif; word-wrap:break-word; width:100%; height:100%; margin:0; padding:0;}
a {text-decoration:underline; color:black;}
a:hover {text-decoration:none;}
#wrappper {background-color:#ffffff; width:600px; margin:60px auto; padding:0 50px 50px;}
#title {background-color:#000000; color:#ffffff; text-align:center; text-transform:uppercase; padding:20px 0; margin:0 -50px 20px;}
table {width:100%; border-collapse:collapse;}
table th {font-size:20px; padding:24px 0 8px; text-transform:uppercase; text-align:left;}
table td {vertical-align:center; padding:4px 1px;}
table table {width:300px; height:50px;}
table table td {border:solid 1px #000000; width:50px; height:50px; padding:0;}
table table td img {display:block; border:0; max-width:30px; max-height:30px; width:auto; height:auto; margin:auto;}
#credit {border-top:solid 2px black; margin-top:40px; padding-top:20px; text-align:center; font-size:12px;}

And then heres the colspan I believe...

<table>
<col width="auto"><col width="150px"><col width="150px">

<tr><th colspan="2">

jsFiddle: http://jsfiddle.net/Zorabelle/sYJKt/


Solution

  • Add empty <td></td>s where you have less than 5 in a given <tr>. Alternatively, if you want to 'join' <td>s, use colspan.

    EDIT: How about using hidden <td>s to maintain the layout, like in this jsFiddle:

    td.hidden {
        visibility: hidden;
    }