Minimum and maximum padding and margin wanted

In What I Want From CSS3 - Part 1, Andy Budd notes that min-padding, max-padding, min-margin and max-margin would be very useful, especially for liquid layouts.

Yes indeed, that would be very useful. I suppose the properties Andy mentions would be the shorthand versions, so to specify the minimum amount of padding for an element you would write something like this:

  1. min-padding: 0em 1em 1em 2em;

And the corresponding longhand would be this:

  1. min-padding-top: 0em;
  2. min-padding-right: 1em;
  3. min-padding-bottom: 1em;
  4. min-padding-left: 2em;

Posted on October 27, 2005 in CSS, Quicklinks

Comments

  1. Forget min-padding. It would be nice for an implementation of min-height/max-height (in IE that is).

    As for min-padding, yeah that’d be nice. :-)

  2. Can’t say I’m missing min/max padding?

    gradient and drop-shadow selectors would get my vote, and help to trim a few unnecessary images from my sites!

    Oh, and corner… Especially if it handled the border too!

    corner:radius 1em; /*bliss*/

  3. October 28, 2005 by Anonymous

    Background-image resizing.
    Borders defined by set of 8 images.

  4. Could be a good idea, however wouldn’t a proper min/max on an element with a percentual padding do the same?

  5. Actually, there are better ideas than introducing new properties for everything you’d want min/max variants for.

    min(), max() and calc() functional notations have been suggested previously, with the idea being that you could specify something like:

    margin: min(10%, 2em); padding: max(5%, 20px); width: calc(80% - 2em);

  6. October 28, 2005 by Roger Johansson (Author comment)

    Chris: Almost, but not quite. Read Andy’s post - he explains the problem with percentages.

    Lachlan: That seems like a good idea.

  7. One thing I miss sometimes is defining whether the scrollbar should be inside or outside (so when I tell a box to be 500 pixels wide, it is 500 pixels wide, not 500┬▒scrollbar, depending on browser’s mood).

  8. Yeah, this would be nice. I’ve often run into situations when min-margins would be useful.

Comments are disabled for this post (read why), but if you have spotted an error or have additional info that you think should be in this post, feel free to contact me.