Line spacing in CSS…

Soldato
Joined
26 Feb 2004
Posts
4,784
Location
Hampshire, England.
Hey guys,

I’ve just started to add text to one of my project sites and I appear to have this problem whereby, the text I add with the <h3> tag for example (see code bellow) gives me huge amounts of line spacing on regular text?

If I don’t use the tags there isn’t a problem with the actual layout, just the font, size etc defaults – but I’d expect that anyway ;)

h3 {
color: #000000;
font-family: Georgia, "Times New Roman", Times, serif;
text-align: left;
font-size: medium;
}


Is there some attribute I’m missing? I’m a bit unfamiliar with .css text formatting :)

Cheers,

SW.
 
A h3 is just a header, you shouldn't really be writing text with it, you could just use the <p> paragraph tag, it'll probably be adding a large margin because it's used as a header. I think I get you...
 
agreed you shouldnt be using header tags for regular text

you can change line spacing in css with

h3 {line-height: n;}

where n can be one of 3 things

  1. "n"em which is a multiplier of the font size, so less than one will decrease line spacing
  2. "n"% for percentage change
  3. "n" for absolute value, pixels, points etc.

This will decrease the space above and below the header, which should probably be only one line anyway

maybe an example of your problem in context (is seeing it) would help us

taken from "html, xhtml and css a visual quickstart guide", which i heartily reccomend
 
Thanks guys ;)

Yeah, I was using header tags for body text :p

You should be able to tell that I don’t add text that often to my sites - only usually get as far as designing a template...

Thanks for the help!

SW.
 
Back
Top Bottom