Table cell width fixed size

Discussion in 'HTML' started by Fabian Vilers, Apr 24, 2006.

  1. Hello all,

    I need to draw a table with fixed size (height + width) cells. In any
    case, the text should never expand the size of the cell.

    Any help is appreciated,
    Fabian Vilers, Apr 24, 2006
    1. Advertisements

  2. __/ [ Fabian Vilers ] on Monday 24 April 2006 09:49 \__
    <table width=VALUEH style="height: VALUEVpx;">

    This table will have a fixed width VALUEH and a minimal height of VALUEV. It
    would not makes sense for the height to be strictly forced, however. This
    would lead to text disappearing and, mind you, tables cannot have scroll
    bars. This is adverse to user's desire and will (just about any stalwart
    advocate of standards would argue this). For this, you might wish to have a
    look into iframes, which are scrollable and have fixed dimensions.

    Hope it helps,

    Roy Schestowitz, Apr 24, 2006
    1. Advertisements

  3. Fabian Vilers

    frederick Guest

    Why on Earth not? What if the text's too big to fit in the defined
    cell size? What if the user makes use of a different size of text than
    you do?
    frederick, Apr 24, 2006
  4. Reanalyze the original problem, and you'll probably notice that you
    don't need to create such problems.

    If you insist on creating a problem with fixed-size cells, set the
    height and width of each cell in CSS _and_ set
    table-layout: fixed
    for the table. Additionally, set the overflow property for the cells;
    the value depends on whether you wish to have content hidden or let it
    overflow outside the cell or have scroll bars in a cell.
    Jukka K. Korpela, Apr 24, 2006
  5. All of the proposals you made was not correct.

    First I must say the business design of the applications I need to work
    on is really poor. Specifications are these, I must wrap the cell content.

    I finally manage to find the solution by myself.

    The content of the cell is enclosed inside a <div style="height: 123px;
    width: 456px; overflow: hidden">

    Anyway; thanks for your responses.
    Fabian Vilers, Apr 24, 2006
  6. Fabian Vilers

    Paul Watt Guest

    If you re-read Jukka's post he said to do that
    Paul Watt, Apr 24, 2006
  7. Well, something in that direction, in the "If you insist on creating a
    problem" part, but I surely did not suggest creating additional problems
    by using px dimensions, and I did not suggest using an artificial <div>
    element, or using inline styles.

    If the business design of an application is really poor, it should be
    redesigned. We have no way of knowing whether the OP even tried asking
    whether the original problem could be fixed. (He mentioned that he "must
    wrap the cell content", which is something completely different and
    might indicate that the business design has been misunderstood.)
    Jukka K. Korpela, Apr 24, 2006
  8. In case it wasn't already obvious, HTML has no way to work around a
    fundamentally misconceived requirement.
    To get a usable result, first redefine the user requirement. No real
    user would really demand that the required text should fail to fit in
    its cell - and that's what you just asked for. Ergo, whoever
    specified this requirement is not representative of a user. The next
    step is yours, I guess.
    Alan J. Flavell, Apr 24, 2006
  9. Fabian Vilers

    Neredbojias Guest

    To further the education of mankind, Fabian Vilers
    You must wrap the cell content and hide the overflow? -With all users'
    varying text-sizes, etc., to deal with? Okay...
    Neredbojias, Apr 24, 2006
  10. I know this sucks
    Fabian Vilers, Apr 25, 2006
  11. Fabian Vilers


    Aug 21, 2007
    Likes Received:
    Either Jukka is extremely new to the game, or plain incompetent. Anyone with a bit of real life experience knows that just because a standard is set out to handle most scenarios, there will ALWAYS be real life cases where it's not sufficient. Coming up with a scenario where you have an independent system where a html based interface needs to trunkate text in table cells is not a hard task for anyones imagination.

    Just the fact that he suggests to "redesign the business design" is proof that he probably hasn't worked very much in larger real world web applications: The person who deals with HTML tables is often very far away from the person who develops business logic.
    stochmind, Aug 21, 2007
  12. Fabian Vilers

    Rex the Strange

    Mar 11, 2009
    Likes Received:
    Here here! I'm also looking for a solution to this same problem. A little tip for those of you who feel the need to say things like "why do you want to do that!?" - that's not particularly helpful and I'm sure the author has his reasons for wanting to do what he wants to do.

    Why do I want to do it? Quite frankly, none of your damn business. If you don't know the answer then you might consider not responding rather than proving what a complete, self-righteous, holier-than-thou a-hole you are.
    Rex the Strange, Aug 19, 2009
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.