Forum Moderators: not2easy

Message Too Old, No Replies

Cell padding

Cell padding in tables

         

Adam5000

4:30 pm on May 20, 2007 (gmt 0)

10+ Year Member



I've created a table and put a thumbnail picture in each cell. And now I'd like to create a little padding in each cell. But I can only get it to work when I name each cell with the class attribute <td class= "cell_one">. Then <style> td.cell_one {padding: 1cm;} </style>.

Is there a way to say give all cells in the table a one centimeter padding on all sides of the cell? Help!

sonjay

4:53 pm on May 20, 2007 (gmt 0)

10+ Year Member



If you want to apply padding to all table cells, you can put this in your stylesheet:


td {
padding: 1cm;
}

If you want to apply padding only to the table cells in that table, give the table a class, and put this in your stylesheet:


table.myclass td {
padding:1cm;
}

Xapti

8:22 pm on May 20, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



depending on what you're doing, you may not even want to use tables for this. Doesn't seem to have much of a purpose if it's just images in there.

if it's just images you're using, the following will be much simpler HTML code:
...
<style type="text/css">
#imageholder{border-left:2px black dotted;border-top:2px black dotted;}
#imageholder img{border-right:2px black dotted;border-bottom:2px black dotted;padding:10px;float:left}
...
</style>
...
<div id="imageholder">
<img><img><img><img><img><img><img><img><img><img><img><img><img><img><img><img>
</div>
...

Also, may I ask why you're using cm for units of measurement? it's a pretty rare situation, usually only when sealing with printer layouts.

Adam5000

5:15 pm on May 24, 2007 (gmt 0)

10+ Year Member



sonjay, X. Thank you for your help.

sonjay. This gives me the padding I need so the thumbnails aren't pushed up against each other. And it works good.

X. What I'm doing is creating a page of thumbnail images and using them as links to the larger pictures. It reduces the download time.
As far as cm go, it was just a handy unit of measure. Px or inches would just as well.
Your method works good too, and I'm working on getting the thumbnails to link to the larger images.

Xapti

10:27 pm on May 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well true. Points, picas, inches, and cm are all essentially the same, just different multipliers (72 pt in an inch, 12 picas in a point, ~3.5 cm per inch)
All of them depend on the DPI setting of your monitor. Considering your dealing with images, which are sized in pixels (otherwise they won't be scaled well), the cm spacing may look odd at lower or higher DPI-resolution combinations.

For some, the image padding may look rather thing, relative to the image, while for others, it would look over-padded, a little strange.

jessejump

7:45 pm on May 27, 2007 (gmt 0)

10+ Year Member



>>>>>>12 picas in a point

1 pica = 12pt

Xapti

8:42 pm on May 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



zyeah I did it backwards whoops.