If you take a look at my website in firefox:

and in internet explorer:

you will see the top menu in internet explorer is on the left.

The css code I have used is:

.overbodyline
{ 
background-image:url(/music/images/main.gif);
background-repeat: repeat-y;
{T_TH_COLOR1} solid;
font-size : {T_FONTSIZE2}px;
color : {T_BODY_TEXT};
padding: 0px 0px 0px 40px;
}

and the table code is as follows:

<table width="100%" cellspacing="0" border="0" class="overbodyline">
      <tr><td><table class="stand" width="700px">random gubbins
</table>
</td></tr>
<table>

For some reason the rest of the padding is fine. I've attached the whole file if you need to check out anything else.

Dani AI

Generated

The posted snippet shows a concrete markup problem: the outer table is not closed — the last line is <table> instead of </table>. Browsers recover from broken HTML in different ways; Firefox often repairs the DOM differently than Internet Explorer, so mis-nested or unclosed tags routinely produce layout/padding differences between the two. Fixing that mismatched tag and re-validating the page is the most likely quick fix (and explains why restructuring the tables, as did, resolved the issue).

A couple of practical, non-speculative points that complement ’s advice: cellpadding is a legacy attribute that applies to all sides, so it cannot target the left only. To add left-only space use a cell-specific rule instead of altering the whole table. For example:

<td class="menu-cell"> ... </td>

.menu-cell {
  padding-left: 40px;
}

Additional troubleshooting tips and cautions: ensure a standards DOCTYPE so browsers use the same box model; run the page through an HTML validator to catch unclosed tags and other syntax errors; use the browser inspector to view computed styles and see which rule wins (specificity/cascade matters); avoid inline attributes in favor of classes on the TD or inner container; and prefer CSS layout over tables for non-tabular content. ’s point about the cascade is key — make cell-level rules more specific if the table or outer classes are overwriting them.

Recommended Answers

All 6 Replies

In general, CSS spacing issues can be resolved by specifying both the "padding" and "margin" properties of all the affected elements.

Tables have their own properties... try setting "cellpadding".

Ah taking of cellpadding - I've tried that and it works but I've found no way of specifying that it only pads the left hand side... any ideas if theres a way to define it?

So theres no way of defining the cellpadding attribute to pad from the left. So back to square one. I wonder why this table is causing trouble when the rest are fine?

CSS attributes "cascade", from least-specific to most-specific. You are also mixing inline attributes with CSS class definitions.

In any given TD for your table, you'll get a "combined" or "derived" style based on the inline attributes, the "overbodyline" class, and the "stand" class. Any attributes you've left undefined (such as "margin") will get whatever default the browser uses.

Is the data in your table really tabular? Are you actually presenting a "table" of data? If not, then consider using DIVs, SPANs, and CSS to control appearance and flow. It will be much simpler to troubleshoot these issues if you didn't mix tables and CSS.

I restructured my tables and got it fixed... yay!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.