Previous Message
Next Message

Controlling text spacing: margin, padding or line-height

Sent by Adriano Castro on 8 November 2005 00:12


Hi,

     I want to control the spacing of my text but I'm not too sure 
whether I should use margin, padding, line-height or a combination of 
these three.

     I need to control the spacing between the lines of a paragraph, the 
space between that very same paragraph and the title that comes before 
it and the space between that paragraph and the one coming after it.

     EXAMPLE:

	## MARKUP

	<h1>title</h1>

	<p class="first-line">Raeseniat. Ut dolorero odo dolobor sit
	prat. Boreet aliquam, corperat, consectem in hent num zzrilis
	moloreet, cons dit eu faccum nissequat il iniamet nim zzril in
	venit veriliq uipsuscillan el dunt dolorpercil ea coreros num
	veliquisi erat, consendio.</p>

	<p>Raeseniat. Ut dolorero odo dolobor sit prat. Boreet aliquam,
	corperat, consectem in hent num zzrilis moloreet, cons dit eu
	faccum nissequat il iniamet nim zzril in venit veriliq
	uipsuscillan el dunt dolorpercil ea coreros num veliquisi erat,
	consendio.</p>


	## CSS

	* {
	   margin: 0;
	   padding: 0;
	}


	h1 {
	   line-height: 1.0em;
	}


	p.first-line {
	   line-height: 1.2em;
	   padding: 2.0em 0 0 0;
	}


	p {
	   line-height: 1.2em;
	   padding: 0;
	}

     Is this correct or should I do it differently?

     Lastly, you might have noticed I've chosen to add a class called 
"first-line" because IE ignores the :first-child pseudo-selector. Do you 
know of any other way of doing this?

     Many thanks,
     AD

-- 
[EMAIL-REMOVED]
www.adrianocastro.net
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message