View Full Version : Creating an empty line - which way is better?


NASCARaddicted
10-30-2011, 04:51 PM
Hello

I want to hear your opinions about the following:

From time to time, some books have an empty line between 2 paragraphs, especially, when there is a scene break or a big span of time.

In the past, I did that with <p>&nbsp;</p>

But recently I got an epub book from the internet and when I looked at the code, I noticed that this one used a different way. In this one, an empty line was created with css, using "margin-top 1.3em". (the line height was set to 130%)

So now I am thinking about which way is better? I think if I use nbsp, the empty line is still there, even if the css file gets lost. But are there also some disadvantages? Is there an advantage if I use margin-top?

Thanks in advance.

dwig
10-30-2011, 07:01 PM
"better" is a value judgement you have to make for yourself, but...

... for scene breaks, I prefer to add a style that has an increased top margin. I typically use one named "p.section" or just ".section" that is a dupe of my base "p" style with a top margin set to 1em instead of 0em. I then simply style the first paragraph after a scene break. Placing this in the CSS stylesheet makes is easy to manage and alter if desired. Similarly, I create a style for the first paragraph in a chapter that does the same, though often a 2em top margin, and also sets the text-indent to 0em instead of the 1em I use for the base p style.

Typically:

p {
text-indent: 1em;
margin-top: 0em;
text-align: justify;
margin-bottom: 0em;
}
.first {
text-indent: 0em;
margin-top: 1em;
margin-bottom: 0em;
text-align: justify;
}
.center {
text-indent: 0em;
margin-top: 0em;
margin-bottom: 0em;
text-align: center;
}
.section {
text-indent: 1em;
margin-top: 1em;
margin-bottom: 0em;
text-align: justify;
}

Adjust
10-31-2011, 03:12 AM
Yeah I do what dwig said as well...

AlexBell
10-31-2011, 03:46 AM
Yeah I do what dwig said as well...

So do I.

I think the main advantage is that if an author or editor wants the 'scene break' to be two lines instead of one then it is the work of seconds to change the style sheet and this automatically changes the distance between the paragraphs.

If it is done by using <p>&nbsp;</> then one would have go through and find every <p>&nbsp;</> and change it to <p>&nbsp;</><p>&nbsp;</>

A lot more work, and nowhere near as elegant.

Jellby
10-31-2011, 05:24 AM
Either use a paragraph style with additional top (or bottom) margin, or a specifically styled empty <div> or <p> (or even <hr/>):

<p>... some text.</p>

<div class="break" />

<p>Text after the scene break...</p>

Some readers might discard the empty <div>, so you can also put an &nbsp; inside. Now you can style it as you wish:

div.break {
height: 2em;
margin: 0;
padding: 0;
}

or have a few asterisks inside, or some border...