Re: CSS width property

> This list is no helpdesk, but the issue you are describing is rather 
> complex. Making "an element size to its contents" is not really possible, 
> as there are a great deal of factors which determine the width of an 
> element. For example, would "Lorem ipsum dolor sit amet" on one line or 
> "Lorem ipsum" and "dolor sit amet" on two lines be correct?

This would work:
p {
  width: max-intrinsic;
/* or */
  width: min-intrinsic;
}
max-intrinsic - width of paragraph without word wrapping;
min-intrinsic - paragraph minimum width;

--- or ---
p {
  max-width: auto; // maximum intrinsic width;
/* or */
  min-width: auto; // minimum intrinsic width;
}

in fact current layout behavior of the table with no 'width' given could be 
described as
table {
  min-width: auto;
  width: auto;
  max-width: auto;
}

Andrew Fedoniok.
http://terrainformatica.com








----- Original Message ----- 
From: "Max Romantschuk" <max@provico.fi>
To: <www-style@w3.org>
Cc: "Timo Frenay" <timo@followyourdreams.nl>
Sent: Monday, January 24, 2005 1:27 AM
Subject: Re: CSS width property


>
> Timo Frenay wrote:
>> I am new to this list and I am desperate for an answer to my question. 
>> Ideally, setting the width, margin-left and margin-right properties on a 
>> block-level element to auto would create a centered box that sizes to its 
>> contents. Instead, all browsers that I know of default the width to 100% 
>> if it is not set explicitly, and only tables and floating elements size 
>> to their contents. Floating has its own problems though, and {display: 
>> table} doesn't work in MSIE/Win. Is there any reliable way to make an 
>> element size to its contents without resorting to floating? Thanks in 
>> advance.
>
> This list is no helpdesk, but the issue you are describing is rather 
> complex. Making "an element size to its contents" is not really possible, 
> as there are a great deal of factors which determine the width of an 
> element. For example, would "Lorem ipsum dolor sit amet" on one line or 
> "Lorem ipsum" and "dolor sit amet" on two lines be correct?
>
> I suggest trying to use relative widths, specifying the left and right 
> margins as well as the width in percentages.
>
> .max
>
> -- 
> Max Romantschuk
> http://max.nma.fi/
> 

Received on Tuesday, 25 January 2005 19:32:30 UTC