Tables as rectangular screen areas

Discussion in 'HTML' started by dfloss, Sep 15, 2006.

  1. dfloss

    dfloss Guest

    This is bad form, but it works. Is there a better way to border-ize a
    rectangle of unknown size?

    <html>
    <body>
    <div>
    <table style="margin-left: auto; margin-right: auto; border-bottom:
    2px solid; border-color: #999" cellspacing="0" cellpadding="0">
    <tr style="font-size: x-large; font-weight: bold"><td>Here is some
    text</td></tr>
    <tr style="font-size: xx-small"><td>&nbsp;</td></tr>
    </table>
    </div>
    </body>
    </html>

    .... insert spacers as needed
    dfloss, Sep 15, 2006
    #1
    1. Advertising

  2. dfloss

    dorayme Guest

    In article <0mmOg.2012$>,
    dfloss <> wrote:

    > This is bad form, but it works. Is there a better way to border-ize a
    > rectangle of unknown size?
    >
    > <html>
    > <body>
    > <div>
    > <table style="margin-left: auto; margin-right: auto; border-bottom:
    > 2px solid; border-color: #999" cellspacing="0" cellpadding="0">
    > <tr style="font-size: x-large; font-weight: bold"><td>Here is some
    > text</td></tr>
    > <tr style="font-size: xx-small"><td>&nbsp;</td></tr>
    > </table>
    > </div>
    > </body>
    > </html>
    >
    > ... insert spacers as needed



    Perhaps you are having trouble styling a div the way you want
    because a div is by default 100% wide, even if the content is
    not. The div does not naturally shrink to the width of the
    content. To make it do so, one method is to estimate the width of
    the content - if it is text, em based width is pretty good - and
    then assign similar to a width specification to the div (with
    appropriate allowances like padding, perhaps a bit to spare etc).


    <div style="margin-left: auto; margin-right: auto; border-bottom:
    2px #999 solid;width:9em;">
    Here is some text
    </div>

    --
    dorayme
    dorayme, Sep 15, 2006
    #2
    1. Advertising

  3. dorayme wrote:
    > In article <0mmOg.2012$>,
    > dfloss <> wrote:
    >
    >> This is bad form, but it works. Is there a better way to border-ize a
    >> rectangle of unknown size?
    >>
    >> <html>
    >> <body>
    >> <div>
    >> <table style="margin-left: auto; margin-right: auto; border-bottom:
    >> 2px solid; border-color: #999" cellspacing="0" cellpadding="0">
    >> <tr style="font-size: x-large; font-weight: bold"><td>Here is some
    >> text</td></tr>
    >> <tr style="font-size: xx-small"><td>&nbsp;</td></tr>
    >> </table>
    >> </div>
    >> </body>
    >> </html>
    >>
    >> ... insert spacers as needed

    >
    > Perhaps you are having trouble styling a div the way you want
    > because a div is by default 100% wide, even if the content is
    > not. The div does not naturally shrink to the width of the
    > content. To make it do so, one method is to estimate the width of
    > the content - if it is text, em based width is pretty good - and
    > then assign similar to a width specification to the div (with
    > appropriate allowances like padding, perhaps a bit to spare etc).


    Or if the goal is to have it look as though it occupies a particular
    proportion of the window's width, use a percentage:

    width: 50%;
    Harlan Messinger, Sep 15, 2006
    #3
    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. Alexander Weddell

    Polar to Rectangular conversion

    Alexander Weddell, Nov 28, 2003, in forum: VHDL
    Replies:
    1
    Views:
    3,425
  2. Chris Berg
    Replies:
    2
    Views:
    1,275
    Chris Berg
    Nov 4, 2003
  3. Grzesiek

    Rotate non-rectangular region

    Grzesiek, Jul 22, 2004, in forum: C++
    Replies:
    2
    Views:
    579
    Gernot Frisch
    Jul 22, 2004
  4. yugas
    Replies:
    7
    Views:
    311
    user923005
    Sep 7, 2007
  5. John B. Matthews
    Replies:
    0
    Views:
    681
    John B. Matthews
    Aug 14, 2008
Loading...

Share This Page