How to decide on using margin or padding in HTML? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How to decide on using margin or padding in HTML?

Jeson84Jeson84 USAPosts: 90Member

Is there a recommended way to use margin and padding in different scenarios in HTML?



  • DavidMDavidM USAPosts: 342Member
    edited February 2014

    From w3 Schools,

    Explanation of the different parts:

    Margin - Clears an area around the border. The margin does not have a background color, it is completely transparent

    Border - A border that goes around the padding and content. The border is inherited from the color property of the box

    Padding - Clears an area around the content. The padding is affected by the background color of the box

    Content - The content of the box, where text and images appear

Sign In or Register to comment.