Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 10-26-2014, 11:52 AM   #1
Phylis Sophical
Member
Phylis Sophical began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Jul 2012
Device: kobo
Stylesheets

Yet another newbie question re, stylesheets. What I'm not understanding is how to create and make use of a stylesheet. Although very experienced in other aspects of computing, this is my first attempt at html / stylesheets, etc. What I'm not getting is the logic behind it all. I've tried working through w3schools tutorials but they are geared to making web pages, not ebooks.

What I have done so far is create a document in Libre Office using as little formatting as possible.
Then save that as an .html file.
Then open that in Sigil.
This story contains some short poems that I want single spaced. Seems everything in Sigil is doublespaced. The only way I've manged to accomplish this is to go into code view and change the tags 'by hand'.
Sigil shows a folder called 'Styles' on the left panel. It is empty. An option to 'add blank stylesheet. Logically, it seems I would do that and type in the html code that would make the poems single spaced. Then somehow, make that code show up only where I want the lines single spaced.

So, is it normal that when you create a doc and open it in Sigil that there is no stylesheet?
Do I create that stylesheet in something like notepad and import it?
Or using Sigil's option to create a blank stylesheet?

Please feel free to correct me where I'm using the wrong wording or logic. You can refer to my post on single space here: http://tinyurl.com/p8jkd6v but please don't offer any more tags. That's not the problem. My problem is how to create and execute a stylesheet.
Phylis Sophical is offline   Reply With Quote
Old 10-26-2014, 12:39 PM   #2
elibrarian
Imperfect Perfectionist
elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.elibrarian ought to be getting tired of karma fortunes by now.
 
elibrarian's Avatar
 
Posts: 645
Karma: 863576
Join Date: Dec 2011
Location: Ølstykke, Denmark
Device: none
You really should study the Sigil user guide here

Sigil guide

You'll also find something about stylesheets and linking them in Sigil there.

Regarding your question elsewhere on this forum ("No space ...") - if nothing but <br /> works, it's probably because you're not linking the stylesheets correctly. Hitch's code actually works!

Regards,

Kim

Last edited by elibrarian; 10-26-2014 at 12:43 PM.
elibrarian is offline   Reply With Quote
Advert
Old 10-26-2014, 12:50 PM   #3
Pablo
Guru
Pablo ought to be getting tired of karma fortunes by now.Pablo ought to be getting tired of karma fortunes by now.Pablo ought to be getting tired of karma fortunes by now.Pablo ought to be getting tired of karma fortunes by now.Pablo ought to be getting tired of karma fortunes by now.Pablo ought to be getting tired of karma fortunes by now.Pablo ought to be getting tired of karma fortunes by now.Pablo ought to be getting tired of karma fortunes by now.Pablo ought to be getting tired of karma fortunes by now.Pablo ought to be getting tired of karma fortunes by now.Pablo ought to be getting tired of karma fortunes by now.
 
Pablo's Avatar
 
Posts: 972
Karma: 4999999
Join Date: Mar 2009
Location: Rosario, Argentina
Device: SONY PRS-T2, Kindle Paperwhite 11th gen
Have a look at my ePub tutorial (see my signature). You may find it useful, although it's quite basic and a little outdated as regards as Sigil.
Pablo is offline   Reply With Quote
Old 10-26-2014, 12:51 PM   #4
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,020
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Stylesheets (CSS) are just another file in plain text.

1) You can, as you discovered, create an empty one in Sigil and enter the Style code.
You can copy and paste saved snippets/or from another CSS, from Notepad(++) or any plain text editor OR Saved Clips ( I have a dozen or so, some are templates that need completion. eg A @font { template, where I fill in the Font name and fonts filename as imported )

1b)You can move the (CONTENTS of the <styles> section to the stylesheet (remember to link the stylesheet back to that document file)

2)You can import (Add Existing) if you are working with (x)HTML export. (DOC does not use a CSS) or have a standard coding

Note stylesheets must contain the styles used in the document (there can be extras, those can be cleaned out in the end. (Tools: Delete unused styles)
theducks is offline   Reply With Quote
Old 10-26-2014, 09:43 PM   #5
st_albert
Guru
st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'
 
Posts: 697
Karma: 150000
Join Date: Feb 2010
Device: none
Let me add my sincere recommendation that you read Pablo's tutorial! Not only will it give you a basic grounding in how to put together an epub, it will also be useful as a basis when you go through the WCC tutorials. Not to mention, helping you understand WHY you might want to do some of the things covered in the Sigil manual.

And since I see you are using Libre Office, I advise you to check out the "writer to latex" and "writer to epub" plugins. Don't install them as-is. They won't work on modern versions of LibreOffice or OpenOffice. But the package contains a stand-alone java program that can convert a LibreOffice .odt file to an epub (not for the faint-hearted, I admit). But if you are in any sense a coder, you will find adequate documentation in the zip file to set yourself up to convert your .odt document to an epub that has very clean code, and is easy to polish in Sigil.

Edited to add: If you take that route (writer2latex.jar), you should make sure that EVERY paragraph in your .odt file has an assigned "Paragraph Style," and every string of characters that is not ordinary (e.g. italic, or bold, or both) within a paragraph has an assigned "character style." Then make sure that every such style has an associated CSS style in the <custom>.xml configuration file. (Do not fear. The documentation should make this clear, how it works.)

Good luck!

Albert

Last edited by st_albert; 10-26-2014 at 09:56 PM. Reason: afterthought
st_albert is offline   Reply With Quote
Advert
Old 10-27-2014, 05:42 AM   #6
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
Posts: 1,054
Karma: 11391181
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
Maybe this kind of newbie-thread (in so far as css is concerned) is the right one for my problem:
I have a text with notes (adjoint to the relative chapters). I added a ".notes"-paragraph style to make the notes look a bit different from the "normal" text (it is from Project Gutenberg). O.k., this worked. There are some notes with citations from other books, esp. poems, and I wanted to emphasize them a bit within the notes. So I added a ".cite" class with larger margin-left and smaller margin-top and margin-bottom.
Code:
p {
    display: block;
    font-size: 1em;
    line-height: normal;
    margin-bottom: 0.3em;
    margin-top: 0.3em;
    text-indent: 1em;
    text-align: justify
    }
.noindent {
    display: block;
    font-size: 1em;
    line-height: normal;
    margin-bottom: 0.3em;
    margin-top: 0.3em;
    text-indent: 0;
    text-align: justify
}
.notes {
    display: block;
    font-size: 1em;
    font-style: italic;
    line-height: normal;
    margin-bottom: 0.3em;
    margin-top: 0.3em;
    margin-left: 2em;
    text-indent: 0;
    text-align: justify
}
.cite {
    display: block;
    font-size: 1em;
    font-style: italic;
    line-height: normal;
    margin-bottom: 0.1em;
    margin-top: 0.1em;
    margin-left: 4em;
    text-indent: 0;
    text-align: left
}
When I applied this to the text (each single line of a poem), the surprise was that
- the text was not italic,
- left margin took no effect,
- instead of smaller margins, they became larger (top and bottom), not only in relation to the preceeding ".notes"-class, but also in relation to a preceeding ".cite"-class.

Any trial to change the settings of the ".cite"-class had no effect at all.

Okay, I could apply the normal ".notes"-class and work with <br />, but I would really like to know what was going wrong. Anybody who could explain it to me? I s this perhaps a Sigil problem?
Leonatus is offline   Reply With Quote
Old 10-27-2014, 09:02 AM   #7
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,020
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Leonatus View Post
Maybe this kind of newbie-thread (in so far as css is concerned) is the right one for my problem:
I have a text with notes (adjoint to the relative chapters). I added a ".notes"-paragraph style to make the notes look a bit different from the "normal" text (it is from Project Gutenberg). O.k., this worked. There are some notes with citations from other books, esp. poems, and I wanted to emphasize them a bit within the notes. So I added a ".cite" class with larger margin-left and smaller margin-top and margin-bottom.
Code:
p {
    display: block;
    font-size: 1em;
    line-height: normal;
    margin-bottom: 0.3em;
    margin-top: 0.3em;
    text-indent: 1em;
    text-align: justify
    }
.noindent {
    display: block;
    font-size: 1em;
    line-height: normal;
    margin-bottom: 0.3em;
    margin-top: 0.3em;
    text-indent: 0;
    text-align: justify
}
.notes {
    display: block;
    font-size: 1em;
    font-style: italic;
    line-height: normal;
    margin-bottom: 0.3em;
    margin-top: 0.3em;
    margin-left: 2em;
    text-indent: 0;
    text-align: justify
}
.cite {
    display: block;
    font-size: 1em;
    font-style: italic;
    line-height: normal;
    margin-bottom: 0.1em;
    margin-top: 0.1em;
    margin-left: 4em;
    text-indent: 0;
    text-align: left
}
When I applied this to the text (each single line of a poem), the surprise was that
- the text was not italic,
- left margin took no effect,
- instead of smaller margins, they became larger (top and bottom), not only in relation to the preceeding ".notes"-class, but also in relation to a preceeding ".cite"-class.

Any trial to change the settings of the ".cite"-class had no effect at all.

Okay, I could apply the normal ".notes"-class and work with <br />, but I would really like to know what was going wrong. Anybody who could explain it to me? I s this perhaps a Sigil problem?
Failure of properly linked stylesheets to style is almost always an error.
Right-click the sheets name in the list and validate.

line-height: normal; is what caught my eyeball
I use line-height: 1.2; (no units) when NEEDED at the P/H level (usually because of mixed sizes in the block)

Another thing that caught my eye (not an error):
Justified Poetry??
theducks is offline   Reply With Quote
Old 10-27-2014, 03:57 PM   #8
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
Posts: 1,054
Karma: 11391181
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
Quote:
Originally Posted by theducks View Post
Failure of properly linked stylesheets to style is almost always an error.
Right-click the sheets name in the list and validate.
Strange, strange... I opened the file on another computer, where Sigil is as well installed, and ... everything works fine now. So ... sorry to waste your time!

Quote:
line-height: normal; is what caught my eyeball
I use line-height: 1.2; (no units) when NEEDED at the P/H level (usually because of mixed sizes in the block)
This value I overtook from somewhere else; I have also been wondering if it's really necessary. BTW: what is "P/H level", please (I'm not a native English speaker)?
Quote:
Another thing that caught my eye (not an error):
Justified Poetry??
No, the poem should appear in the ".cite" class, and there the text-align is: left.

Thank you for your hints, anyway!
Leonatus is offline   Reply With Quote
Old 10-27-2014, 07:02 PM   #9
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,020
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
P or H# type tags

<h3 class="foo" <<< Click anywhere on the line
Click the P button (near all the H# buttons on the toolbar)
the tags change from h3 to p the class remains
theducks is offline   Reply With Quote
Old 10-28-2014, 04:26 AM   #10
Leonatus
Wizard
Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.Leonatus ought to be getting tired of karma fortunes by now.
 
Leonatus's Avatar
 
Posts: 1,054
Karma: 11391181
Join Date: Mar 2013
Location: Guben, Brandenburg, Germany
Device: Kobo Clara 2E, Tolino Shine 3
This sounds interesting; I didn't know about that yet.

What did I learn? Put some superfluous question in this (really great) forum, and you'll receive totally new informations anyway.

Thank you!
Leonatus is offline   Reply With Quote
Old 10-28-2014, 03:56 PM   #11
Phylis Sophical
Member
Phylis Sophical began at the beginning.
 
Posts: 15
Karma: 10
Join Date: Jul 2012
Device: kobo
Thanks to all of you for what looks like some very useful replies. It'll take me awhile to work through all this, but I'm watching the post daily.

elibrarian, I've read the excellent Sigil guide and I've found it very well written for other aspects, the stylesheet section is way too general for a beginner.

Pablo: have downloaded your tutorial. Looks like what I need. Thxs.

st_albert: I tried 'writer to epub' plugin a couple of years ago when I really didn't have a clue. Thxs to your post, I will try it again. Just thought with Sigil, I wouldn't need something like that.
Phylis Sophical is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom CSS Stylesheets for Calibre's Viewer Ralob Viewer 389 11-24-2024 11:10 AM
error in linking stylesheets eschwartz Editor 3 01-09-2014 02:25 AM
Validate Stylesheets opens with ADE Moonraker Sigil 3 11-05-2012 09:56 AM
Alternate stylesheets Jellby ePub 1 08-19-2011 06:44 PM
User stylesheets for ePub files salty-horse Sony Reader Dev Corner 12 02-23-2010 07:44 AM


All times are GMT -4. The time now is 07:12 AM.


MobileRead.com is a privately owned, operated and funded community.