14 replies [Last post]
Master Zen
Offline
newbie
Last seen: 15 years 6 weeks ago
Joined: 2005-08-14
Posts: 6
Points: 0

Hello

For some strange reason table padding properties just do not work in a new site I've been doing in DW. I have worked with CSS before and it was just a matter of adding the padding propery to a CSS class and then assigning that class to a table in HTML and IE would immediately show the padding.

Now, however, neither DW nor Firefox seem to do the job (nor IE either).

for example, take this class:

.file			{ width: 800px; padding: 5px; }

which is added to the HTML like this:

<table cellspacing="0" class="file">

But the padding is NOT respected, only the width. The only solution I have found is to add a new class below ".file" called ".file td" with the padding property and it works. However this creates another problem: all tables under this one inherit that padding property which is incredibly annoying. Worse, I can't add padding to an individial <td> element because it won't respect it either (and I have yet to find a workaround to this)

I am very annoyed because before it was only a matter of adding the padding property to any class and it would be ok. Now it just doesn't work (and I've practically copy/pasted the old .css files I had to the new ones and they don't work like before)

I am stumpted. Please help. Sad

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 27 weeks 1 day ago
Joined: 2004-06-30
Posts: 9668
Points: 801

Help with tables and padding

1. Show us your code.

2. Stop testing in IE and test in FF.

3. Ditch tables, you should be using divs Laughing out loud

Verschwindende wrote:
  • CSS doesn't make pies

Master Zen
Offline
newbie
Last seen: 15 years 6 weeks ago
Joined: 2005-08-14
Posts: 6
Points: 0

Help with tables and padding

1. There is nothing more to show. Padding simply does not work in ANY table element and if I add a ".class td" below it, it works, but messes up all tables (inherits the padding properties) and cells (cannot specify any padding at all) below it. I have already tested this with just a simple 2x2 table and just one CSS class in the sheet. And it does NOT work. Doesn't work as an ID either.

2. I've tested it in both. Doesn't work in either

3. I'd do so if I knew how Tongue

Anonymous
Anonymous's picture
Guru

Help with tables and padding

Master Zen wrote:
1. There is nothing more to show.
Then we are done here, right?

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 27 weeks 1 day ago
Joined: 2004-06-30
Posts: 9668
Points: 801

Help with tables and padding

If you don't show us the code, we can't hope to help you.

Tables and rows and cells are dodgy, as are the table heads and feet, and cellspacing.

It's a fickle thing, and would be easier if you showed us the code.

Verschwindende wrote:
  • CSS doesn't make pies

DeprecatedDiva
DeprecatedDiva's picture
Offline
Enthusiast
NW Louisiana
Last seen: 13 years 41 weeks ago
NW Louisiana
Timezone: GMT-6
Joined: 2005-06-12
Posts: 135
Points: 0

Help with tables and padding

Post your code, even if it is only a two-cell table with some html & css in the head. It's always better to observe everything in context.

DeprecatedDiva

Master Zen
Offline
newbie
Last seen: 15 years 6 weeks ago
Joined: 2005-08-14
Posts: 6
Points: 0

Help with tables and padding

this is the css file

/* Global Settings */

body			{ font-family: Verdana; font-size: 10pt; background-image:url('images/bkgnd_sky.jpg'); background-attachment: fixed; }
table			{ font-size: 8.5pt; border-style: none; }
td				{ font-size: 8.5pt; border-style: none; vertical-align: top; }
a:active		{ color: #0000FF; text-decoration: none; }
a:hover			{ color: #000080; text-decoration: underline; }
a:link			{ color: #000080; text-decoration: none; }
a:visited		{ color: #000080; text-decoration: none; }

/* Entry Settings */

.file			{ width: 800px; padding: 5px; }
.file td		{ padding: 5px; }

the .file td part is what I have to add to make it work, but like I said, all tables below it inherit that 5px padding which I DON'T want, I only want the table with that specific class to have it.

<table cellspacing="0" class="file">
  <tr>
    <td>'; include $inc . 'top.php'; echo '</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>
  </tr>
</table>

It's part of a PHP file btw, just in case you wondered.

Anonymous
Anonymous's picture
Guru

Help with tables and padding

Master Zen wrote:
It's part of a PHP file btw, just in case you wondered.
We still need to see all of it and not just a snippet. How else am I going to complain about lack of doctype and such? Laughing out loud

I got $$$ on it!!! Laughing out loud

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 27 weeks 1 day ago
Joined: 2004-06-30
Posts: 9668
Points: 801

Help with tables and padding

What is it you're trying to lay out? You shouldn't be using tables, this could be the problem.

Verschwindende wrote:
  • CSS doesn't make pies

Anonymous
Anonymous's picture
Guru

Help with tables and padding

thepineapplehead wrote:
What is it you're trying to lay out? You shouldn't be using tables, this could be the problem.
That question could have been answered by a link after the first request for one. :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea: :idea:

Master Zen
Offline
newbie
Last seen: 15 years 6 weeks ago
Joined: 2005-08-14
Posts: 6
Points: 0

Help with tables and padding

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

could that be the problem? The old page I was using (I had used FP instead of DW) didn't even have a Doctype. Tongue

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 14 hours 35 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9767
Points: 3849

Help with tables and padding

Recheck your selectors and the cascade. The following snippet puts 10px padding in a generic table's td and 20px in table of class="file" tds. A generic table following a file table does not 'inherit' the padding. This is one reason to see more code. What you describe isn't normal behavior, so there is something else involved.

 
td { 
    padding: 10px;  
    border: 1px solid black; 
    } 
 
.file td { 
    padding: 20px; 
    } 
 
td p { 
    background-color: yellow; 
    } 
=========== 
      <table summary="a td padding test"> 
        <tr> 
          <td> 
            <p>now is the time</p> 
          </td> 
        </tr> 
      </table> 
 
      <table class="file" 
             summary="a td padding test"> 
        <tr> 
          <td> 
            <p>now is the time</p> 
          </td> 
        </tr> 
      </table> 
 
      <table summary="a td padding test"> 
        <tr> 
          <td> 
            <p>now is the time</p> 
          </td> 
        </tr> 
      </table>

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Master Zen
Offline
newbie
Last seen: 15 years 6 weeks ago
Joined: 2005-08-14
Posts: 6
Points: 0

Help with tables and padding

nothing can be simpler than this: a simple table, and a simple class which assigns a padding property to the table. Result: no padding actually shows on the table, but it DOES show in the last cell which I gave the same property too.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.paddedtable {
	padding: 5px;
}
-->
</style>
</head>

<body>
<table cellpadding="0" cellspacing="0" class="paddedtable">
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td class="paddedtable">&nbsp;</td>
  </tr>
</table>
</body>
</html>

Can anyone just say if tables do not support paddings? It would be much easier to address the problem if I only knew this small bit of knowledge.

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 14 hours 35 min ago
Dallas
Timezone: GMT-5
Joined: 2004-06-25
Posts: 9767
Points: 3849

Help with tables and padding

Padding is not a property of table. The class may be applied to the table, but the padding is applied to the td as a descendent of the table of that class, as in my demo.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.

Master Zen
Offline
newbie
Last seen: 15 years 6 weeks ago
Joined: 2005-08-14
Posts: 6
Points: 0

Help with tables and padding

Hmm. Seems I have solved the problem using a combination of class and id selectors, and also becaused I noticed that Dreamweaver messes up table padding in the design view.

Thanks to everyone for their help, I really appreciate it. Smile