Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / January 2007



Tip: Looking for answers? Try searching our database.

css 2.1 negative width calculations?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dave8421@hotmail.com - 26 Jan 2007 21:03 GMT
Hi,

I am reading CSS 2.1 draft specification:
http://www.w3.org/TR/2006/WD-CSS21-20061106/

Part of section 10.3.3 (Block-level, non-replaced elements in normal
flow) reads:

   If there is exactly one value specified as 'auto', its used value
follows from the equality.

In the case that
  margin-left + margin-right > width of containing block
(see the constraint in 10.3.3) this would mean that 'width' would be
computed as a negative value in order for the equality to balance.

I'm not sure how a negative width is interpreted.  It would seem that
from tests in firefox and opera that they treat used width as 0.
Ben C - 26 Jan 2007 22:08 GMT
> Hi,
>
[quoted text clipped - 11 lines]
> (see the constraint in 10.3.3) this would mean that 'width' would be
> computed as a negative value in order for the equality to balance.

Yes.

> I'm not sure how a negative width is interpreted.  It would seem that
> from tests in firefox and opera that they treat used width as 0.

I'm not sure the spec says anywhere how to interpret a negative width.
You can't actually set a negative value for the width property (that's
"illegal"), although as you say the computed value can be negative.

It makes most sense for it to be rendered as equivalent to 0 (rather
than rendering the box inside-out!)
Ben C - 26 Jan 2007 22:48 GMT
> Hi,
>
[quoted text clipped - 14 lines]
> I'm not sure how a negative width is interpreted.  It would seem that
> from tests in firefox and opera that they treat used width as 0.

The other thing is that even if the browser does follow the spec and
compute a negative width, and renders that as a zero width (which seems
the only logical choice), then it has to choose whether to respect the
styled value of margin-left or the styled value of margin-right-- it
can't make both true.

What they mostly seem to do is clamp width to 0 and solve the equality
by taking the difference out of margin-right (and it seems logical it
ought to be margin-left if direction is rtl).

I think it would make more sense if the spec were written that way.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.