N1CK3RS0N Posted April 12, 2010 Share Posted April 12, 2010 Hello, I'm working on a new design for my CMS and I'm trying to get this issue straightened out. The problem is FireFox adds padding outside the box, instead of inside. So if you had a box with 200px width and added 10px padding, the box is now 220px, instead of 200px with its contents confined to 180px; What I'm trying to do is running the body at 100% width. The main column is 65% width and the side column is 35% width. I want to add some padding between them so they do not run right against eachother, so I set the margins on the sides of the columns to 5px. But now it expands further than the 100%, so it wraps that 2nd column down to another row. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/198306-firefox-paddingmargin-issues/ Share on other sites More sharing options...
haku Posted April 13, 2010 Share Posted April 13, 2010 Yes. The best way to have cross-browser compatibility with margins and paddings is to use two divs instead of one. Set the width (or height) on the outer div, and the margins/paddings on the inner div. Your problem happens when you set a width and side paddings/margins on the same div, or a height and top/bottom margins/paddings on the same div. Doing what I suggested fixes the problem. Quote Link to comment https://forums.phpfreaks.com/topic/198306-firefox-paddingmargin-issues/#findComment-1040654 Share on other sites More sharing options...
N1CK3RS0N Posted April 13, 2010 Author Share Posted April 13, 2010 Yes. The best way to have cross-browser compatibility with margins and paddings is to use two divs instead of one. Set the width (or height) on the outer div, and the margins/paddings on the inner div. Your problem happens when you set a width and side paddings/margins on the same div, or a height and top/bottom margins/paddings on the same div. Doing what I suggested fixes the problem. Indeed. Thats how I ended up solving it. Been a while since doing templates, mostly been doing PHP lately. Remember that trick while watching TV then ran to my computer to try it out hehe. Thanks though Quote Link to comment https://forums.phpfreaks.com/topic/198306-firefox-paddingmargin-issues/#findComment-1041192 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.