[ACCEPTED]-Padding the top and the bottom of inline element-xhtml

Accepted answer
Score: 15

Use inline-block instead. Add these properties 2 to all the elements on which you want to 1 add padding. For example:

a:link {
display: inline-block;
display: -moz-inline-box;
-moz-box-orient: vertical;
vertical-align: top;
zoom: 1;
*display: inline;
}
Score: 7

If I understand correctly, and from an example I 7 just made:

a) the text is an inline element, so 6 me adding a span with top and bottom padding 5 is not pushing the other lines down

b) as 4 you can see, since I've added a color to 3 the span, the color will overlap the other 2 lines.

I hope this is both right, and answers 1 your question :D

Score: 2

Try this:

<style type="text/css">
  div { background: blue; height: 4em; padding: 1em }
  span { background: red; padding: .5em; }
</style>

<div>
  <span>one</span>
  <br/>
  <span>two</span>
</div>

0

Score: 1

The padding will affect the element itself. For 2 example, any text within the element will 1 be more padded from other DOM elements.

More Related questions