tags:

views:

83

answers:

4

Margin, padding, or whatever?

+10  A: 

line-height attribute, more details: http://www.css3.com/css-line-height/

Note that even though that link points to css3.com, line-height has been in the spec since CSS1.
Tatu Ulmanen
Yes, and it is supported by all browser. Also it is usually better to use em as unit for it, as some browser will not scale it with the text properly otherwise.
For "some browser", read IE6 :P
Skilldrick
+1  A: 

If your lines stored in single <div> or <p> element, your can use(as was mentioned above) line-height(line-height) attribute. In case, when lines are placed in different block elements, yuo can modify space between two lines with margin(margin description) or padding(padding description) attributes.

Alex
+1  A: 

Margin is used to specify the distance between elements.

Padding is used to specify the padding between an element and it's content.

Line-height is used to specify the height of text lines in a continuous text.

So, if you have separate elements that you want a distance between, margin is appropriate:

<p style="margin: 5px 0">Line 1</p>
<p style="margin: 5px 0">Line 2</p>

If you have a continuous text where you want a distance between the text lines, line-height is appropriate:

<p style="line-height: 1.8em">Long text that spans several lines...</p>
Guffa
A: 

Great answer. Short Sweet and to the point. Thanks for the easy clarification.

Joe R
FYI this should be a comment on an answer, not another answer. Looks like you don't have the rep to leave a comment, so you'll have to answer a few questions yourself to gain some rep before commenting.
Graeme Perrow