Jump to content

Stop padding stacking on divs


beennn

Recommended Posts

How can I stop the padding on a div from stacking? By this I mean, I have several of the same div next to one another with a padding of 30px, as the divs are placed next to each other, this gives a gap of 60px between them, and only a gap of 30px between other elements. How can I make sure only 30px is on each side and stop there padding from stacking?

Link to comment
Share on other sites

It is not stacking it's following exactly what you are telling it. If you put padding 30 on a div and repeat it you will have this|30(div)30|30(div)30| exactly as you specified. I would create a class specifically for the divs that will be side by side and one for divs beside other elements.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...