Explain Best Padding Techniques to Me

Hi Guys



I’ve just tried adding 10px padding to ColumnLeft, but I’ve found this expands the width of the div and pushes ColumnRight below it.

In general, what padding techniques are best? Should I be padding the div, or should I be padding the h1 and p tags within the div? I need to get an idea of best practice.

Many thanks

Would I be right in saying that the correct technique is to add a container div around the div I want to pad, then add the width property to the container div, and have just the padding on the div I want padded.


At least a couple of choices:

The css box model says that the width of a container is the sum of the declared width plus any padding. So, you can keep the 10px padding but you need to reduce the width value to 580px.

Another method is to add left and right padding or margins to the contained text.

The easiest way is to put a div inside the divs with a width set and put the padding on that inner div, while not giving it a width.