Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] Div sticks out when padding is added Reply To: [Solved] Div sticks out when padding is added

#157414
__
Participant

If I was using something like ‘normalize.css’ would I have come accross this layout issue?

Yes, because normalize doesn’t “fix” things, it …”normalizes” them.

If you want a simpler, more intuitive box model, you can apply that box-sizing rule to everything in your document:

*,*:before,*:after{ box-sizing:border-box; }

I do this quite often. Be aware, however, that it will “mess up” any layouts that were designed with the standard box model in mind — third-party code, for example. It’s not just a matter of stylesheets, either; many javascript packages write css styles directly to dom elements, and you don’t have the opportunity to easily override those. I would not recommend doing this without thoroughly examining your code any making sure nothing will break.