MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Sigil (https://www.mobileread.com/forums/forumdisplay.php?f=203)
-   -   Sigil Nav.xhtml Line Break Issue (https://www.mobileread.com/forums/showthread.php?t=291530)

Dave_M 10-24-2017 06:04 PM

Sigil Nav.xhtml Line Break Issue
 
In my ebook nav.xhtml, below is the code I'm dealing with. I would like to have a blank space between the Preface and Part One of the book. However, any code I try to add to create a blank space or line (such as <br/>)does not work. I keep getting a parsing error. Should I pursue creating a different line class in my style sheet? Can anyone help? Thanks, Dave

<h1>CONTENTS</h1>
<ol>
<li>
<a href="../Text/Section0008.xhtml#preface">Preface (Adam Davis)</a>
</li>
<li>
<a href="../Text/Section0009.xhtml#one_part">ONE: BEYOND THE IMAGE</a>
</li>

Turtle91 10-24-2017 06:07 PM

Use CSS to set the formatting:

li {margin-top:2em}


You should have a css stylesheet (something like "stylesheet.css") where you can put the code above. Then link that sheet be right-clicking on your html file(s) and selecting "link stylesheet". Point it to your stylesheet and...voila!


edit: OH! And Welcome to MR!!

Dave_M 10-24-2017 06:21 PM

Hi. Thank you! This is my first post. Er, that was. :)

Well, I tried that early on. But the issue is that I want extra space only in three places: between Part I, Part II, and Part III in the table of contents in the nav.xhtml file. I need to add a blank space between those three lines. In other words, I don't want to add extra white space between every entry in the contents. Does that make sense?

Turtle91 10-24-2017 09:46 PM

Then you give those special cases a class name:

Code:

CSS
li.space {margin-top:2em}

HTML
<li class="space">Part I</li>
<li>One</li>
<li>Two</li>
<li>Three</li>
<li class="space">Part II</li>
<li>Four</li>
<li>Five</li>
<li>Six</li>
<li class="space">Part III</li>
<li>Seven</li>
<li>Eight</li>
<li>Nine</li>

edit:
You can even go crazy and give them 'spiffy' ;) formatting just by changing the CSS like this:

Code:

li      {text-indent:2em}
li.space {margin-top:2em; text-indent:0; font-weight:bold;
          color:blue; text-decoration:underline; font-size:1.5em}

OK...I went a little crazy on the formatting....but I just wanted to show that you can format your book any way you want to very easily by setting up the proper CSS. It will really help to spend a couple hours reading those tutorials and picking up some basics of CSS.

Cheers!

Turtle91 10-24-2017 09:54 PM

You can find a lot of information about how to style/format your ebooks on the MR Wiki, the ebook production page, and a great tutorial reference page on W3Schools.

exaltedwombat 10-25-2017 02:35 PM

Or, just manually use
li style="margin-top:2em"
instead of li for the few instances that require it. It's not 'best practice' but it works, and we all do it :-)

AlanHK 10-25-2017 04:20 PM

Quote:

Originally Posted by Dave_M (Post 3599483)
In my ebook nav.xhtml, below is the code I'm dealing with. I would like to have a blank space

I believe the nav.xhtml is an epub3 feature; it's a file that normally should not be displayed at all.

In Sigil, use the tool Table of Contents/Create HTML Table of Contents to make a page you can edit and format without consequence.

Or copy the nav file to a normal xhtml file and format that if you want the list format.

KevinH 10-25-2017 04:33 PM

Actually the nav is epub3 but it can serve as both a machine-parsed html toc or a normal html toc depending on if you want it to be. I have seen nicely formatted navs used that are still machine readable and therefore able to replace the toc.ncx and html toc if needed nicely.

Turtle91 10-25-2017 08:58 PM

Quote:

Originally Posted by exaltedwombat (Post 3599982)
Or, just manually use
li style="margin-top:2em"
instead of li for the few instances that require it. It's not 'best practice' but it works, and we all do it :-)

INLINE STYLING!! BLASPHEMY!!! :eek::eek:


It is better to learn the proper/easy/accepted way of doing it first...then they know when they are breaking the rules and why.

Dave_M 10-26-2017 11:47 AM

Thanks, everyone. And, Turtle, that fix worked!

I had tried before to do something similar, create a special class, but for some reason it didn't work (probably a naming issue on my part). Again, your code worked. Many thanks! Can't say enough.

Dave
ps. I didn't get spiffy. But in the future, I might just. :)

Hitch 10-26-2017 08:03 PM

Quote:

Originally Posted by Turtle91 (Post 3600210)
INLINE STYLING!! BLASPHEMY!!! :eek::eek:


It is better to learn the proper/easy/accepted way of doing it first...then they know when they are breaking the rules and why.

Turtle:

I just wanted to say, I've had a really crap week. I was sick (over my damn weekend, of course) and this week has felt a million years long thus far. I really needed that laugh. Not that it's not absolutely true, mind you, but the laugh was perfect. TY for that.

Hitch

Turtle91 10-26-2017 08:45 PM

Sorry for the awful week - but glad I could lighten it somewhat!

Glad to help Dave - Cheers!


All times are GMT -4. The time now is 08:21 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.