Interview Questions

Why was the decision made to make padding apply outside of the width of a 'box', rather than inside, which would seem to make more sense?

CSS Interview Questions and Questions


(Continued from previous question...)

38. Why was the decision made to make padding apply outside of the width of a 'box', rather than inside, which would seem to make more sense?

It makes sense in some situations, but not in others. For example, when a child element is set to width: 100%, I don't think it should cover the padding of its parent. The box-sizing property in CSS3 addresses this issue. Ideally, the issue should have been addressed earlier, though.

(Continued on next question...)

Other Interview Questions