Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Hiding table columns – any simple way?

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #46551
    tomasz86
    Participant

    I want to make specific columns invisible.

    http://codepen.io/anon/pen/Gtjue

    This “should” work but in reality the only browser where it does is IE8. In Firefox the borders are still displayed and in Chrome the above CSS settings have no visible effect.

    Is there any better way to do it instead of applying styles to each TD separately like this?

    http://codepen.io/anon/pen/aygKD

    #143605
    Subash
    Member

    You can use `nth-of-type()` pseudo element to hide second column.



    td:nth-of-type(2) {
    display: none;
    }

    http://codepen.io/anon/pen/zqGFg

    #143608
    Paulie_D
    Member

    td:first-of-type + td {
    display:none;
    }

    #143806
    Kitty Giraudel
    Participant

    Based on a 6 columns table, if you want to hide ONLY the third, you could do:

    td + td + td { display: none; }
    td + td + td + td { display: block; }

    #143831
    Paulie_D
    Member

    >but I’d really like to avoid it since it’s a huge table with almost 2500 TDs.

    Wouldn’t that be basically useless from a readabilty standpoint?

    #143851
    Paulie_D
    Member

    Pre-filtering of results before displaying the table would seem to best best option.

    Of course, I have no idea how to do that. :)

    #143867
    Paulie_D
    Member

    How are you going to enable columns on request?

    Sounds to me like you need JS.

    #143870
    Kitty Giraudel
    Participant

    Checkbox hack. Pretty dirty. Do you have a reason you don’t want to use JS?

    I highly recommand [this](http://filamentgroup.com/lab/responsive_design_approach_for_complex_multicolumn_data_tables/). Definitely what you’re looking for.

    #144670
    Kitty Giraudel
    Participant

    > This way everything should look the same even in IE5.

    I see no good reason for this.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘CSS’ is closed to new topics and replies.