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
Related Q & A:
- How to add a border to layout?Best solution by Stack Overflow
- When I Turn a song in my car stereo i got a sony xplod stereo and when flip threw songs it thump in my subs?Best solution by Yahoo! Answers
- How can I have a border around the center part of my Myspace profile, just the bit that is white?Best solution by Yahoo! Answers
- How do I get a border around my profile?Best solution by Yahoo! Answers
- How long does it take for an orange seed to grow from when it is a seed to when it is a tree?Best solution by wiki.answers.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.