Forums

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

Home Forums CSS set max characters inside table cell?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #25036
    davidliu
    Member

    Hi CSSers,

    I have a table with table-layout:fixed property with 5 headers <th>. How do I set the data cells <td> within each of the headers to have a maximum character allowed? I tried ‘maxlength’ but it didn’t work.

    Is there a property I’m missing out?

    Thank you very much!
    Dave

    #58578
    TheDoc
    Member

    Max characters allowed? You mean before the line breaks down (<br>)?

    Or do you mean total allowed characters in a cell?

    The first one can simply be done by setting a width on the cell.

    Code:
    td {
    width:200px;
    }

    The latter will need to be done with some sort of PHP I’d assume. Some sort of trim function.

    #58606
    davidliu
    Member

    Thanks Doc!

    I was going for the 2nd one, which is total characters allowed.

    At the moment I got a fixed table-layout and applied this to the td:
    table td {
    background:#e8edff;
    border-bottom:1px solid #fff;
    border-left:1px solid #fff;
    color:#336699;
    border-top:1px solid transparent;
    padding:8px;
    text-overflow:ellipsis;
    overflow:hidden;
    white-space:nowrap;

    }

    I think I gotta go with the php thing, a friend will help me with that.

    Thank you!

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