Reputation: 6987
Is there a limit on the amount of padding
/ margin
/ translateX
/ etc a div
can have ?
For instance, would something like margin-left: 999999999px
work reliably across browsers ?
Upvotes: 2
Views: 531
Reputation: 29635
The CSS3 standard (http://dev.w3.org/csswg/css-values/#lengths) does not specify a limit for lengths, it just states that it is a dimension (a number/integer with a unit identifier). And it doesn't specify a limit for integers either.
MDN gives the same description, but on this page (https://developer.mozilla.org/en-US/docs/Web/CSS/integer) it states that
There is no official range of valid values. Opera supports values up to 2^15-1, IE up to 2^20-1 and other browsers even higher. During the CSS3 Values cycle there were a lot of discussion about setting a minimal limit to support: the latest decision, in April 2012 during the LC phase, was [-2^27-1; 2^27-1] # but other values like 2^24-1 and 2^30-1 were also proposed # #. The latest Editor's draft doesn't list a limit anymore.
So I guess the limit will depend on the limits set by the browser that you use.
Upvotes: 1