03-08-2011, 06:27 AM | #1 |
Junior Member
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 |
03-08-2011, 09:05 AM | #2 |
Wizard
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" /> |
03-08-2011, 10:26 AM | #3 | |
Well trained by Cats
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:
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. |
|
03-08-2011, 05:03 PM | #4 |
Connoisseur
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 |
03-09-2011, 04:34 AM | #5 |
Junior Member
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 |
03-09-2011, 05:46 AM | #6 |
Guru
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. |
04-12-2011, 05:20 PM | #7 | |
Witless protection Agent
Posts: 290
Karma: 1002898
Join Date: Nov 2009
Location: Los Angeles
Device: Kindle
|
Quote:
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. |
|
04-13-2011, 04:53 AM | #8 |
Wizard
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? |
04-13-2011, 11:19 AM | #9 | |
Well trained by Cats
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:
As you pointed out, Splits done within Sigil will populate the the XHTML section properly. |
|
04-21-2011, 07:08 PM | #10 | |||
Witless protection Agent
Posts: 290
Karma: 1002898
Join Date: Nov 2009
Location: Los Angeles
Device: Kindle
|
Quote:
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:
Quote:
|
|||
04-22-2011, 07:12 AM | #11 |
Wizard
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.
|
04-22-2011, 12:22 PM | #12 |
Well trained by Cats
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) |
Tags |
css, style |
|
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 |