How can I split an HTML element?

Is HTML element padding only relevant when there is a border around the element to which the padding is?

  • applied? In other words, is there any difference in the resulting display of the example text between "padding" and "margin" in the following example, which has no border around its "div" element? Isn't the example text simply indented by 0.5 in from the left margin in both cases? <div style="padding-left: 0.5in"> example text 1 </div> <div style="margin-left: 0.5in"> example text 2 </div> But is there a difference in the resulting display of the example text between "padding" and "margin" in the following example, which has a border around its "div" element? In the first example is the space between the border and the text simply set to 0.5 in and the border left in place at the margin? But in the second example aren't the border and the example text both indented by 0.5 in from the margin? <div style="border-left: green 0.1in solid; padding-left: 0.5in"> example text 1 </div> <div style="border-left: green 0.1in solid; margin-left: 0.5in"> example text 2 </div>

  • Answer:

    Padding relates to inside the element where it is used. Margin relates to outside the element. Your examples are not the same. If they were, there wouldn't be any need but for one of them. Ron

Casey at Yahoo! Answers Visit the source

Was this solution helpful to you?

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.