tables and CSS

Discussion in 'HTML' started by Jure Erznoznik, Apr 22, 2005.

  1. Let's say, we have a table:

    <table>
    <tbody>
    <tr>
    <td></td>
    <td></td>
    <td></td>
    </tr>
    ....
    </tbody>
    </table>

    I want to have a specific style associated with each of the columns which I
    currently accomplish through <td class="colxx">.
    Is it possible to achieve the same result without specifying class for each
    and every <td>?
    <colgroup/> doesn't seem to work???
    Using XHTML 1.0 strict (IE in quirks mode).

    Thanks,
    Jure
     
    Jure Erznoznik, Apr 22, 2005
    #1
    1. Advertising

  2. Jure Erznoznik

    Sid Ismail Guest

    On Fri, 22 Apr 2005 10:33:43 +0200, "Jure Erznoznik" <>
    wrote:

    : Let's say, we have a table:
    :
    : <table>
    : <tbody>
    : <tr>
    : <td></td>
    : <td></td>
    : <td></td>
    : </tr>
    : ...
    : </tbody>
    : </table>
    :
    : I want to have a specific style associated with each of the columns which I
    : currently accomplish through <td class="colxx">.
    : Is it possible to achieve the same result without specifying class for each
    : and every <td>?


    In you head
    <style type="text/css">
    <!--
    td {font-size:80%; border:1px dotted navy;}
    -->
    </style>

    Sid
     
    Sid Ismail, Apr 22, 2005
    #2
    1. Advertising

  3. ???
    I don't see how this could help me?!? You are only setting font size and
    border for your cells.

    My table is on the 3rd level of nesting and has to be 100% width because of
    another table following right after this one and this table is some sort of
    header for the following one).

    Thanks anyway,
    Jure

    "Sid Ismail" <> wrote in message
    news:...
    > On Fri, 22 Apr 2005 10:33:43 +0200, "Jure Erznoznik" <>
    > wrote:
    >
    > : Let's say, we have a table:
    > :
    > : <table>
    > : <tbody>
    > : <tr>
    > : <td></td>
    > : <td></td>
    > : <td></td>
    > : </tr>
    > : ...
    > : </tbody>
    > : </table>
    > :
    > : I want to have a specific style associated with each of the columns
    > which I
    > : currently accomplish through <td class="colxx">.
    > : Is it possible to achieve the same result without specifying class for
    > each
    > : and every <td>?
    >
    >
    > In you head
    > <style type="text/css">
    > <!--
    > td {font-size:80%; border:1px dotted navy;}
    > -->
    > </style>
    >
    > Sid
    >
    >
     
    Jure Erznoznik, Apr 22, 2005
    #3
  4. Jure Erznoznik

    mbstevens Guest

    Jure Erznoznik wrote:

    > Let's say, we have a table:
    >
    > <table>
    > <tbody>
    > <tr>
    > <td></td>
    > <td></td>
    > <td></td>
    > </tr>
    > ...
    > </tbody>
    > </table>
    >
    > I want to have a specific style associated with each of
    > the columns which I currently accomplish through <td
    > class="colxx">. Is it possible to achieve the same
    > result without specifying class for each and every <td>?
    > <colgroup/> doesn't seem to work???
    > Using XHTML 1.0 strict (IE in quirks mode).


    http://www.mbstevens.com/test/column.html
    .....has a few ideas.

    IE in quirks mode AND an XHTML-strict doctype??
    ________

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie60/html/cssenhancements.asp
    __________
    Not sure what you're getting at about quirks mode here,
    but I'd drop it.
     
    mbstevens, Apr 22, 2005
    #4
  5. Jure Erznoznik

    Steve Pugh Guest

    mbstevens wrote:
    > Jure Erznoznik wrote:
    >
    > > Using XHTML 1.0 strict (IE in quirks mode).

    >
    > IE in quirks mode AND an XHTML-strict doctype??


    If there's a XML declaration (or anything except whitespace) before the
    doctype then IE goes into quirks mode regardless of the actual doctype.

    Stupid but true.

    Steve
     
    Steve Pugh, Apr 22, 2005
    #5
  6. Jure Erznoznik

    mbstevens Guest

    Steve Pugh wrote:
    >If there's a XML declaration
    >(or anything except whitespace) before the
    > doctype then IE goes into quirks
    > mode regardless of the actual doctype.


    > Stupid but true.


    Oh, yeah, you're right, I remember now.
    I always use xml declarations in my normal pages,
    but my particular style never uses
    for things that seems to break under IE when I test.
    I'll have to boot into XP and see if my example
    page still works.
     
    mbstevens, Apr 22, 2005
    #6
  7. Jure Erznoznik

    mbstevens Guest

    mbstevens wrote:

    > Steve Pugh wrote:
    >>If there's a XML declaration
    >>(or anything except whitespace) before the
    >> doctype then IE goes into quirks
    >> mode regardless of the actual doctype.

    >
    >> Stupid but true.

    >
    > Oh, yeah, you're right, I remember now.
    > I always use xml declarations in my normal pages,
    > but my particular style never uses
    > for things that seems to break under IE when I test.
    > I'll have to boot into XP and see if my example
    > page still works.


    Seems to still work, at least in IE6 under XP.

    (Drifting OT; stupid XP held me up by trying
    to install hardware, warning me of this and that,
    and generally irritating the bloody hell out of me
    by pitching a M$ approved firewall before I could have a
    look. They don't call them the Evil Empire for nothing.)
     
    mbstevens, Apr 22, 2005
    #7
  8. Jure Erznoznik

    Toby Inkster Guest

    Jure Erznoznik wrote:

    > My table is on the 3rd level of nesting and has to be 100% width because of
    > another table following right after this one and this table is some sort of
    > header for the following one).


    That doesn't sound much like tabular data to me.

    In answer to your original question, applying styles to COL and COLGROUP
    elements may not always give the results you expect. You can really only
    assign vertical borders and text alignment that way.

    It has to do with CSS inheritance -- TD elements can only inherit from
    their *real* parents -- the TR elements -- and not from the COL elements
    because they're not "inside" the COL elements.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Apr 24, 2005
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Rae

    Tables and CSS

    Mark Rae, Jul 16, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    1,970
    Mark Rae
    Jul 17, 2004
  2. Christopher R

    Tables and CSS

    Christopher R, Jun 26, 2003, in forum: HTML
    Replies:
    1
    Views:
    815
    David Dorward
    Jun 26, 2003
  3. Peter Bassett
    Replies:
    3
    Views:
    967
    Augustus
    Aug 15, 2003
  4. Otuatail

    Tables within tables

    Otuatail, Jul 31, 2004, in forum: HTML
    Replies:
    7
    Views:
    521
  5. Chris Brat
    Replies:
    5
    Views:
    717
    =?iso-8859-1?q?Luis_M._Gonz=E1lez?=
    Aug 22, 2006
Loading...

Share This Page