Click here to get back home

html table, colspan weirdness I don't know how to work around

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
html table, colspan weirdness I don't know how to work around Peter Kellner 04-18-2006
Get Chitika Premium
Posted by Peter Kellner on April 18, 2006, 10:26 pm
Please log in for more thread options


I've got my problem down to a very simple example that shows it.
Basically, I have an html table in a header file, and an html in my
body. Both have the same width, and the same number of columns. One
table has 2 actual columns (that span 3 columns each) and the other
has 6 columns (no spanning).

Problem is the two tables don't line up.

What am I not understanding or setting? I'm thinking they should line
up. They don't in IE or firefox.

Here's the simple HTML:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"><title>
        Problem Child Code
</title></head>
<body>
        <form name="form1" method="post" action="Default5.aspx"
id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJOTI1NTQ5NTU3ZGQ=" />
</div>

                <div>
                        <table id="TableFindEmail" border="0"
cellpadding="0">

        <tr>
                <td style="width: 134px;">
                                                1
                                        </td>
                <td style="width: 133px;">
                                                2
                                        </td>
                <td style="width: 133px;">
                                                3
                                        </td>

                <td style="width: 133px;">
                                                4
                                        </td>
                <td style="width: 133px;">
                                                5
                                        </td>
                <td style="width: 134px;">
                                                6
                                        </td>
        </tr>

</table>

                        <table id="Table1" border="0" cellpadding="0">
        <tr>
                <td style="width: 400px" colspan="3">
                                                1
                                        </td>
                <td style="width: 400px" colspan="3">
                                                4
                                        </td>
        </tr>

</table>

                </div>
        </form>
</body>
</html>
Peter Kellner
http://peterkellner.net

Posted by Jim Moe on April 19, 2006, 2:01 am
Please log in for more thread options


Peter Kellner wrote:
> I've got my problem down to a very simple example that shows it.
> Basically, I have an html table in a header file, and an html in my
> body. Both have the same width, and the same number of columns. One
> table has 2 actual columns (that span 3 columns each) and the other
> has 6 columns (no spanning).
>
> <table id="TableFindEmail" border="0" cellpadding="0">
> [6 columns removed]
> </table>
>
> <table id="Table1" border="0" cellpadding="0">
> <tr>
> <td style="width: 400px" colspan="3">1</td>
> <td style="width: 400px" colspan="3">4</td>
> </tr>
> </table>
>
What columns do you expect the second table to span? There are only the
two columns, therefore the colspan is spurious and ignored. The first
table has 6 columns but that is irrelevant to the second table.
If you combine the two tables into one, the columns are aligned.

Your example does not demonstrate your stated problem. It looks okay in
my browser (Mozilla). Until I add borders. You have a "pixel perfect"
design and almost anything will cause it to fall apart. So I suspect you
have left something out, like CSS that adds spacing, borders, margin, etc.
Provide an URL for a test case. It's the only way to be sure.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)

Posted by Peter Kellner on April 19, 2006, 12:21 pm
Please log in for more thread options


[This followup was posted to comp.infosystems.www.authoring.html and a
copy was sent to the cited author.]

list.AXSPAMGN@sohnen-moe.com says...
> Peter Kellner wrote:
> > I've got my problem down to a very simple example that shows it.

> What columns do you expect the second table to span? There are only the
> two columns, therefore the colspan is spurious and ignored. The first
> table has 6 columns but that is irrelevant to the second table.
> If you combine the two tables into one, the columns are aligned.
>

Your tip was good. It was a combination of cellpadding not being 0 in
my real example as well as a style sheet confusing me.

Thanks for the help.

Posted by Nije Nego on April 19, 2006, 6:32 pm
Please log in for more thread options


On Tue, 18 Apr 2006 19:26:51 -0700, Peter Kellner wrote:

cut
> Peter Kellner
> http://peterkellner.net

What does .... code validations .... stand for?

--
o'tom po'tom

or
Similar ThreadsPosted
Colspan - rowspan HTML Table August 19, 2004, 3:08 am
Explorer table weirdness... can anyone explain? April 25, 2005, 10:47 am
Table Within Table with colspan and width=100% August 15, 2005, 10:41 am
Table COLSPAN & ROWSPAN October 25, 2005, 8:22 am
Newbie: Problems with table cells & colspan August 9, 2004, 7:11 pm
input submit weirdness--help September 22, 2004, 1:15 am
Re: Why this html doesn't work? May 26, 2008, 1:38 am
HTML doesn't work for FIREFOX January 6, 2007, 9:15 am
February 24, 2005, 1:04 am
colspan="1/2"? November 18, 2006, 10:39 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap