|
Posted by Harlan Messinger on 09/15/06 16:02
dorayme wrote:
> In article <0mmOg.2012$IA.1107@newssvr11.news.prodigy.com>,
> dfloss <dfloss@imap.com> 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> </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%;
[Back to original message]
|