Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 03-08-2011, 06:27 AM   #1
eNG1Ne
Junior Member
eNG1Ne began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Mar 2011
Device: Zaurus
getting started - how to use my CSS

Trying out my first conversion, and enjoying it a lot already!
So ... I have a CSS file I've already used in an earlier version of the source, and I was rather hoping I'd be able to re-use it with Sigil.

Question 1. Where does the .css have to be in order to show up in the Styles folder?

Question 2. Once the .css file is in the right place, do I have to add all the class= tagging by hand in the code view?

Thanks for your advice.

Niels Grundtvig Nielsen
You know what you're talking about ‒ I can help you say it
www.kbss27.be

Last edited by eNG1Ne; 03-08-2011 at 06:28 AM. Reason: add sig
eNG1Ne is offline   Reply With Quote
Old 03-08-2011, 09:05 AM   #2
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
Ad 1. You can add it by right-clicking on the Styles folder and choose 'add existing item'. The CSS is then added to the ePub.

Specify the epub, but putting the following line between the <head>-tags:
Code:
<link href="../Styles/stylesheet.css" rel="stylesheet" type="text/css" />
You need to add the class= by hand of course. However, you can use search and replace with some RegEx. That might be useful to save time.
Toxaris is offline   Reply With Quote
Old 03-08-2011, 10:26 AM   #3
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: 30,447
Karma: 58055868
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 Toxaris View Post
Ad 1. You can add it by right-clicking on the Styles folder and choose 'add existing item'. The CSS is then added to the ePub.

Specify the epub, but putting the following line between the <head>-tags:
Code:
<link href="../Styles/stylesheet.css" rel="stylesheet" type="text/css" />
You need to add the class= by hand of course. However, you can use search and replace with some RegEx. That might be useful to save time.
Be absolutely sure to make the part I highlighted in red match the name of your stylesheet in the Styles section

You might also note that you are not limited to a single stylesheet in a EPUB.
The advantage as I see it: You avoid monster size stylesheets, that need to be processed for every segment
Say you have a really complex set of styles that are only used for the 'front matter' (Title page, copyright, raves...) . Give those pages, their own Stylesheet, and the body of the book, it's own: Lean and Mean stylesheet for quicker page rendering.
theducks is offline   Reply With Quote
Old 03-08-2011, 05:03 PM   #4
Faster
Connoisseur
Faster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of lightFaster is a glorious beacon of light
 
Posts: 61
Karma: 12096
Join Date: Sep 2010
Location: Tasmania
Device: Sony PRS 650
Hi,
In case you're unfamiliar with Regex here's what you would use to insert the 'class=' stuff in the <p> tag:
Select Match case, Minimal Matching and Regular expression. Also Direction 'All' and Look in 'All HTML files'.
FIND: (\<p)(\>)
REPLACE: \1 class="blah blah"\2
Note space between '\1' and 'class...'
For other tags change the 'p' to 'h2' etc and amend "blah blah".

Having said that, there doesn't seem much point doing this if all the <p> tags are using the same rule as you'd just have one css rule for 'p'. Guess I got carried away with a Regex puzzle! Sorry.

Last edited by Faster; 03-09-2011 at 11:44 AM. Reason: Stupidity
Faster is offline   Reply With Quote
Old 03-09-2011, 04:34 AM   #5
eNG1Ne
Junior Member
eNG1Ne began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Mar 2011
Device: Zaurus
Thanks! so now I've found out how to add a css file in the Styles folder...

Next question: I agree entirely with the idea of small, multiple stylesheets for different blocks of content, and dutifully follow the tip to break the source up into smaller sections: but do I really have to add the stylesheet link to every section file? that's less elegant :-{

Niels Grundtvig Nielsen
You know what you're talking about ‒ I can help you say it
www.kbss27.be
eNG1Ne is offline   Reply With Quote
Old 03-09-2011, 05:46 AM   #6
Perkin
Guru
Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.Perkin calls his or her ebook reader Vera.
 
Perkin's Avatar
 
Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
You have to include the link to a stylesheet only if you're going to use any of the styles defined in said stylesheet. Otherwise how will that section file know which styles to use.

You may have several stylesheets which define the same styles but with different options - dependant on reader/viewer to be used. So the section file will need to be instructed specifically which file to use.
Perkin is offline   Reply With Quote
Old 04-12-2011, 05:20 PM   #7
FatDog
Witless protection Agent
FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.
 
Posts: 290
Karma: 1002898
Join Date: Nov 2009
Location: Los Angeles
Device: Kindle
Quote:
but do I really have to add the stylesheet link to every section file? that's less elegant
I am having the same problem.

I cut/paste text into Sigil to create 1 HTML file. Then I add in my stylesheet to get indentation and things the way I like it. (My needs are pretty basic so the stylesheet is pretty simple).

Then I find the chapter breaks in the text and use the "Add Chapter Break" menu to break the huge HTML into smaller chunks.

But 002...00N HTML files do not inherit the stylesheet from the first page. The second, third, HTML files also seem to put some empty tags between paragraphs that I then have to use Search/Replace to remove to avoid tag-bloat. Then I have to use more regex to put in the stylesheet tag in the 002-00N pages.

I understand that the pre-story HTML pages for the copyright, TOC, Preface, etc. might require a more complicated stylesheet than later pages. But it seams natural to me that if you break up 1 big HTML file into smaller chapter-sized files with the "Insert Chapter Break" feature - the resulting pages should include the stylesheet and follow the format of the original/massive HTML page.

Or - be able to right-click a style-sheet and choose a menu item that says "Apply stylesheet to all Chapters" and let Sigil do the search and replace.

Note: I am enjoying Sigil. I sit with it on an old Dell laptop while keeping an eye on the TV with the rewind button if I miss something. I'm not creating new content in epub but converting legacy content. I know I am not playing to Sigil's strengths using it to convert, but the ability to convert and see the results and edit small changes is wonderful.

Last edited by FatDog; 04-12-2011 at 05:28 PM.
FatDog is offline   Reply With Quote
Old 04-13-2011, 04:53 AM   #8
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
That is strange. When I split a file, the header is copied to the new file together with the information below the splitting point. That includes the link to the stylesheet. So, your method should enable you to have the stylesheet to the files.
What do you mean with empty tags? Sometimes the Tidy function will change some code, but I have never seen it between paragraphs. Do you also experience it if you switch Tidy off?

Could you give an example of the source before and after the split? I think there must be something in the code causing Tidy to do this.

I assume where you say HTML, you mean XHTML, right?
Toxaris is offline   Reply With Quote
Old 04-13-2011, 11:19 AM   #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: 30,447
Karma: 58055868
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 Toxaris View Post
That is strange. When I split a file, the header is copied to the new file together with the information below the splitting point. That includes the link to the stylesheet. So, your method should enable you to have the stylesheet to the files.
What do you mean with empty tags? Sometimes the Tidy function will change some code, but I have never seen it between paragraphs. Do you also experience it if you switch Tidy off?

Could you give an example of the source before and after the split? I think there must be something in the code causing Tidy to do this.

I assume where you say HTML, you mean XHTML, right?
Me thinks the poster is slitting the files before importing them into Sigil
As you pointed out, Splits done within Sigil will populate the the XHTML section properly.
theducks is offline   Reply With Quote
Old 04-21-2011, 07:08 PM   #10
FatDog
Witless protection Agent
FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.FatDog ought to be getting tired of karma fortunes by now.
 
Posts: 290
Karma: 1002898
Join Date: Nov 2009
Location: Los Angeles
Device: Kindle
Quote:
Me thinks the poster is slitting the files before importing them into Sigil
Nope. I am cutting and pasting text into a single page in Sigil. Then I search through for "Chapter ..." or "Part ..." and I am using the "Insert Chapter Break" menu item above these lines to break the large page in to smaller chapters.

The new pages do not seem to include the same stylesheet reference as the original page. (I will try to post a specific example this weekend).

Quote:
What do you mean with empty tags? Sometimes the Tidy function will change some code, but I have never seen it between paragraphs. Do you also experience it if you switch Tidy off?
My text file looked like this:

Quote:
I was walking down the street..

Suddenly I spotted...

She came up to me and ...
The blank lines between paragraphs caused Sigil to create empty paragraph tags. I solved this by writing a macro to remove all blank lines but put <p> and </p> tags at the beginning and end of each paragraph. The only trick is I now have to open the Code View and find the correct spot to paste in the tagged text. It's a little crude but it works.
FatDog is offline   Reply With Quote
Old 04-22-2011, 07:12 AM   #11
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
Ah, you use book view. I spend about 95% of my Sigil time in the codeview. I like to see what I am doing.
Toxaris is offline   Reply With Quote
Old 04-22-2011, 12:22 PM   #12
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: 30,447
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Book view to fix words, Split chapters.
Code view for just about everything else
In Code view S&R works across all files (if selected)
theducks is offline   Reply With Quote
Reply

Tags
css, style


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
epub CSS versus "Regular" CSS konrad ePub 4 02-18-2011 10:29 AM
css pseudo elements and adjacent combinators in extra css? ldolse Calibre 2 12-21-2010 06:09 PM
Utter CSS noob looking to get started MacEachaidh Sigil 21 07-05-2010 10:54 PM
Let's getting started ! ^^ scaza Introduce Yourself 2 03-04-2009 01:25 PM
Can u help me to get started? jeremygold Sony Reader 2 01-02-2009 01:27 PM


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


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