[Wylug-help] very simple HTML table colwidth issie

Simon Greenwood sfgreenwood at gmail.com
Thu Jan 23 14:41:19 UTC 2014


Hi -

In HTML a table is a single object and has a body and an optional header so
making it a single table will reduce the inaccuracy. Once you've done that,
you probably want to set a width either as a fixed figure or a percentage
as otherwise the first row in the table effectively defines the overall
width. If you have an idea of what data is going in it, it's useful to set
the definitions in the header row. You can also set them in the first data
row but the header will take precedence.

s/


On 23 January 2014 14:06, Gary Stainburn <gary.stainburn at ringways.co.uk>wrote:

> My premis is that I have used identical text to define both tables so
> surely
> both should be identical when rendered.
>
> In both cases the table is larger than the DIV that contains it, but with
> overflow allowed on both I would have thought that this was not the
> problem.
>
> I cannot see why on the header table the TD is 'X' number of px wider than
> in
> the data table, where 'X' seems to be a constant
>
> On Thursday 23 January 2014 13:58:25 Simon Greenwood wrote:
> > Hi -
> >
> > The table header and the table data have to be within the same table or
> > they don't know about each other. You can use divs inside the table to
> > define styles. IE is probably more fast and loose with this that Firefox
> > and Chrome are. If they don't match up after that then you may have to
> > fiddle with padding and colspans.
> >
> > s/
> >
> > On 23 January 2014 13:43, Gary Stainburn
> <gary.stainburn at ringways.co.uk>wrote:
> > > Hi folks.
> > >
> > > I'm having a go at a home grown solution for having a scollable table
> > > with locked column headers.  I've stripped the problem back to it's
> > > simplest.
> > >
> > > I have two DIV's, one containing a table with the column headers in,
> one
> > > with
> > > a table containing the data.
> > >
> > > Despite both being defined the same, the TD widths on the two tables
> > > differ,
> > > which means that the headers don't line up.
> > >
> > > Can anyone tell me why please?
> > >
> > > BTW, it works in IE8 but  not in Firefox.  I'm guessing I need to set
> > > something in CSS but as both div's and tables are set up the same I
> don't
> > > know what.
> > >
> > > The last TD is 20px wider in the header, as is the table, to make room
> > > for the
> > > scroll bar in the table.  However, I have removed this difference and
> it
> > > didn't affect the problem.
> > >
> > > http://www1.ringways.co.uk/test_table.html
> > >
> > > Gary
> > >
> > > --
> > > Gary Stainburn
> > > Group I.T. Manager
> > > Ringways Garages
> > > http://www.ringways.co.uk
> > >
> > > _______________________________________________
> > > Wylug-help mailing list
> > > Wylug-help at wylug.org.uk
> > > https://mailman.lug.org.uk/mailman/listinfo/wylug-help
>
>
>
> --
> Gary Stainburn
> Group I.T. Manager
> Ringways Garages
> http://www.ringways.co.uk
>
> _______________________________________________
> Wylug-help mailing list
> Wylug-help at wylug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/wylug-help
>



-- 
Twitter: @sfgreenwood
"TBA are particularly glib"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/wylug-help/attachments/20140123/679c7b61/attachment.html>


More information about the Wylug-help mailing list