Box model rule alerts when width or height are set to auto #287

Closed
menzer opened this Issue Jun 14, 2012 · 3 comments

Projects

None yet

3 participants

@menzer

The purpose of the box model rule is to alert the author to potentially unforeseen sizes due to the box model when width or height declarations are combined with other box-model declarations. But if the width or height declaration is overriding a set value and returning to auto, in an OOCSS extension for example, then a padding or border declaration should not trigger the box alert rule, as there is explicitly no expected height or width on the element.

@mahonnaise
.foo {
  padding: 5px;
  width: auto;
}

This does indeed trigger a warning. I agree that it shouldn't. It actually shouldn't trigger a warning whenever the value isn't a <length/percentage>. [There are a bunch of other possible values].

[Side note: I recommend to disable this rule, because it's actually not very helpful. It's supposed to detect a glaringly obvious defect, which hits you right in the face when you produce it. When it doesn't tell you something you've already noticed yourself a few minutes ago, it will just waste your time with false positives. I.e. you did the math and you get indeed the results you were after.]

@nzakas

Makes sense. So basically, it should warn only when width or height is a <length> or <percentage> and otherwise not.

@mahonnaise

"Don't use width or height when using padding or border."

Will need some rephrasing, too.

@nzakas nzakas closed this in e025e5a Jul 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment