Spacing paras/list items less crudely

greiggy

Registered
Is there a way of spacing paragraphs or lists less crudely? As I understand it, html allows for closed up paras or lists, or a complete line in between, but that's all.

I would like my copy to look more like a printed page e.g. half a line or so of extra space between paras. Anyone know of a way to do this?
 
Just a question/observation: wouldn't percentages be more appropriate? Isn't em just related the font height/size and hence not the complete line height?

Code:
P { line-height: 150% }

See note here:
Microsoft Internet Explorer*3.x incorrectly treats number values and values with em or ex units as pixel values. This bug can easily make pages unreadable, and so authors should avoid provoking it wherever possible; percentage units are often a good choice.
 
For spacing between paragraphs, use:

p {

margin-bottom:8px;

}

or ems, or percentages, or whatever your heart desires. Which units to use is a whole 'nother issue.

You might need to play around with padding-bottom as well. Paragraphs (and other block-level elements) have default margins and paddings that are determined by the individual browser, so if you specify both, you won't get unexpected defaults kicking in.
 
just remember, margin is the space between the item (paragraph) and the next, padding is the space between the contents of the item, and the edge of it.
 
I think from my limited knowledge of CSS "line-height" would alter all the line spacing, so I "margin-bottom" looks like what I want:

I have tried as below:

<p class="bodyMssg" {margin-bottom:8px;}>They assign a Centurion (officer)
and some soldiers to guard Paul and some other prisoners and they find
a ship which is going West along the coast.</p>
<p class="bodyMssg" {margin-bottom:8px;}>&#8220;We boarded a ship&#8230;
bound for Ephesus and ports west.</p>
 
Set the font-size on the body tag in a percentage (70% to 85% range) and IE will handle anything in EMs just fine.

Nice thing about using EMs is as the text size increases (user increases it), the spacing will follow keeping everything in proportions.

Spacing for each line is line-height, spacing between paragraphs would be margin.
 
Okay, I am clear now about what is line-height and what is margin and margin is what I want to adjust. Can anyone tell me why my html above is wrong.?

Whether it's px or ems I feel I should be able to see the white space alter
 
greiggy said:
Okay, I am clear now about what is line-height and what is margin and margin is what I want to adjust. Can anyone tell me why my html above is wrong.?

Yeah, that's not the proper syntax for CSS. If you want to use inline css, use this:
<p style="margin-bottom:8px;">

OR for an external stylesheet, use this in your html page:
<p class="bodyMssg">

And this in your stylesheet:
p.bodyMssg {margin-bottom:8px;}

And link to the external stylesheet by putting this in the head section of your html document:
<link href="style.css" rel="stylesheet" type="text/css">
 
Thanks, sonjay. That's really helpful and very clear -- I can work on the style sheet now. I'm a bit of a beginner with html and css and I'm really grateful for the help
 
Have worked with the suggestions above. What I seem to get is 1 1/2 lines space between list items i.e. the line space + the extra ems of px or whatever you put in the CSS style sheet.

What I am actually trying to achieve is a list with approx 1/2 em of what space between list items.

Like in print, if it's setting in 10/12pt and the para space is set to 6pt, so a list item would turn its lines at roughly single line spacing, but at the end para there would be that 6pt white space before the next item.

Is there a way to do this in html or is the minimum para space a whole line of white space?
 
At this point I have lost the structure of the page - the new paras don't appear as new paras and there is a 0.5 em spacing appearing more or less at random! I'm on a learning curve here and not far up it ;:cool:

Incidentally I realise there is a mixture of CSS style sheet and some additonal html spacing -- I was experimenting to see what would work between CSS and html but I know I'm not heading down a good road here . . .

Here the html of a couple of paras:

<p class="bodyMssg">5. Prepared to battle</p>
<p class="bodyMssg">Daniel 10, Matt 11: 12 &#8220;forceful men&#8221;,<br>
Matt 12: 28-29 &#8220;&#8221;if I drive out demons&#8230;then the kingdom
of God has come&#8230;tie up the strong man&#8221;</p>
<p class="bodyMssg"><strong>George Whitefield</strong> was a powerful preacher
in voice and message in the late 1700s. He was accompanied by a crippled
man (we don't know his name) who was his prayer warrior. <br>
Finney&#8217;s prayer partners, Clary and Nash. <strong>Charles Finney</strong>
ministered in the 1820-50s. He was accustomed to walk to the next town
and pray as he walked. He would know what to preach (often prophetically)
when he arrived.</p>
<p class="bodyMssg" style="margin-bottom: 0.5em">But the ground would have been prepared by &quot;Father
Nash&quot; and by Clary, who were prayer warriors, travelling ahead, renting
a place and just praying for souls and the entrance of the word. Who was
the revivalist?<br>
<i><o:p></o:p></i></p>
</td>
 
I'd bet the .5em spacing is appearing under the paragraphs where you put style="margin-bottom:0.5em" in the paragraph tag. An inline style will override any margin-bottom declaration you put in the external style sheet.

Now, can we also see what you've got declared for bodyMssg in your style sheet? And maybe you could also give us a peek at what you have declared for p in your style sheet?
 
Sorry, should have included CSS with html above.

p is simple:

<p class="bodyMssg">5. Prepared to battle</p>
 
I meant the CSS in your style sheet, as in what do you have declared for bodyMssg? Something like:

.bodyMessg {
margin-bottom: somethinghere;
padding: something;
line-height: something;
otherstuff: something;
}
 
Gave you what was in there, copied directly off the external CCS style sheet entry. Parameters above would have been left as defaults so not entered specifically. BTW (Sonjay) I really like your TWW index page -- very clean, nice typography. Some Q's about that, I'll start another thread.
 
greiggy, you've got to open up the external css stylesheet, look at it, and tell us what the style declarations are for p and p.bodyMessg.

We know that in your html you have paragraphs assigned the .bodyMessg style class, and that some of those paragraphs also have a bottom margin assigned, but we don't know what else the stylesheet is telling those paragraphs to do.

There should be a file, probably called styles.css, style.css, stylesheet.css, or something along those lines, containing the bodyMessg declaration. It should contain something like what I posted above:
.bodyMessg {
margin-bottom: .5em;
line-height:1.2em;
}

We need to know what it says.

Also -- as a side note -- I'll give you two free bonus tips today, no extra charge. ;)

First tip: Do you know about ordered and unordered lists? Your example "5. Prepared to battle" looks suspiciously like it could/should be an unordered list. You could do like so:

<ol>
<li>Polish your sword</li>
<li>Gird your loins</li>
<li>Prepare to do battle</li>
</ol>

And you'll get a nicely formatted ordered list that looks like this:
1. Polish your sword
2. Gird your loins
3. Prepare to do battle

Two advantages of tagging your list as an ordered list are that a) the list is formatted with a hanging "outdent" (so that multiline items wrap with the text all aligned and the number off to the left), and b) if you re-order your items, they automatically get renumbered. (A third advantage, if you care about such things, is that your markup will be semantically correct -- i.e., paragraphs are tagged as paragraphs and lists as lists.) So that if you changed your list to:

<ol>
<li>Gird your loins</li>
<li>Polish your sword</li>
<li>Prepare to do battle</li>
</ol>

You'd then get:
1. Gird your loins
2. Polish your sword
3. Prepare to do battle

You can style the ol and li too -- I generally give the ol a generous line-height to make it easy to ready, and use a margin-bottom declaration for li to create some extra vertical spacing between individual list items.

Second free tip: When you have a series of paragraphs and you want to apply a class to all of them, you can save yourself a bunch of typing by not putting class="bodyMssg" in every p tag. You can wrap the whole series inside a <div class="bodyMssg"></div>, and then put this in your stylesheet:

div.bodyMssg p {
styles here
}

This says, "every p that's inside that div tag should be styled thusly." It will leave the rest of your paragraphs, outside the div tag, alone, but will style all the paragraphs inside the div.

But we really need to see the declarations in your stylesheet to figure out what's going on. If you have this online somewhere, a link would help.
 
Hi Sonjay,
Thanks for very helpful input. Yes I do know about ol and li but hadn't thought of applying styles to them in the way you suggest.

I think we are a little at cross-purposes: I don't hand-code this copy as I work under strict time limitations. Example is taken from a published handout which I have dropped into a table section by section using DreamWeaver.

You asume I'm a pro like you, right? Not so -- I use DreamWeaver for speed and that explains why the html isn't as clean as it would be if hand coded.

I have only one css sheet on this site (called s-bStyleSheet1.css) which was created in DW. It has about 20 styles and the BodyMssg one is typical except I have added the margin-bottom declaration. I opened the sheet and took the BodyMssg section straight out to post.

My stuff has major changes of content all the time which means that hand coding really isn't practicable. Not including writing the copy, I need to change the content of a page in 10-15 mins.

What I am trying to do it to adapt the css styles created in DW to work a little better.

DW gives me CSS definitions for type (font, size, weight, style, variant, lineheight, case, colour and decoration)
also for background (mainly for tiling images or b/g colour etc)
and for block (word spacing, letter spacing, vertical alignment, text align [=justify etc], text indent and whitespace [preserve or collapse]

Then you have box, border, list, positioning and extensions.

margin-bottom would be a declaration not supported in DW but I don't see any problem in adding it to the declarations as you suggested.

Also I add html styles such as bold or size change for speed where needed, also the list commands.

Given this compromise and the need to work fast on frequent changes, can you suggest a way through to give approx em and a half spacing for headings and half em spacings, on paragraphs?

Thanks so much for your help and for bearing with me. OK, you may say, learn to hand-code really fast! But DW is designed to do this job, I might just need to learn to tweak the code it puts in.
 
Back
Top