Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 04-07-2015, 01:50 PM   #1
oenopion
Member
oenopion began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Apr 2015
Device: Kindle, Nook, Android
Newbie with CSS question

Hi, brand new to Sigil and formatting, but I have some basic css understanding.

My stylesheet is working for several of my headers, which I have modified and have taken just fine. But when I try to define a first paragraph no indent style (changing the <p> to a <p.first> which I have added to the css, it works fine when I look at it after jumping out of code view. However, when I try to save it, it reverts back to <p>.

I imagine there is a piece of code I am missing, or that is inserted somewhere keeping this change from taking place? Anyone have any ideas.
oenopion is offline   Reply With Quote
Old 04-07-2015, 02:11 PM   #2
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,553
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by oenopion View Post
But when I try to define a first paragraph no indent style (changing the <p> to a <p.first> which I have added to the css, it works fine when I look at it after jumping out of code view. However, when I try to save it, it reverts back to <p>.
I hope you're not actually putting the code <p.first> in your xhtml?

If you have a p.first { } entry in your css, you apply it to an element by adding the "class" attribute to that element with a value of "first". Specifically; <p class="first">
DiapDealer is offline   Reply With Quote
Advert
Old 04-07-2015, 02:45 PM   #3
oenopion
Member
oenopion began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Apr 2015
Device: Kindle, Nook, Android
Of course I was actually putting it in!
I guess I should amend my first statement about having some basic css understanding...

And yes, your code worked like a charm. Thanks!

Actually I had seen that on the Sigil manual, and tried it, but I had set my indent to .001 which doesn't seem to work, so it didn't appear to have worked? Somewhere I read that some ereaders will auto indent 0 defined paragraphs, and it was suggested to have a minute indent like .001? But, as mentioned, I have only been at this conversion stuff since yesterday! Thanks again for your help.

... whoops, almost signed off before also asking ... What's the best way to amend all my other 34 first chapter paragraphs? Is there any type of s&r trick, or paste them in one by one?
oenopion is offline   Reply With Quote
Old 04-07-2015, 05:20 PM   #4
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
Quote:
Originally Posted by oenopion View Post
What's the best way to amend all my other 34 first chapter paragraphs? Is there any type of s&r trick, or paste them in one by one?
That depends on the element that precedes the first paragraph. If it's for example a <h3>...</h3> heading, you could theoretically use a regular expression that searches for a closing h3 tag followed by an opening p tag.

However, it'd be probably more efficient to use a CSS plus operator in your stylesheet.

Assuming that all your chapter headings are enclosed in h3 tags, you could for example use the following styles to indent all paragraphs except for the first paragraph immediately following a h3 heading.

Code:
p { text-indent: 1em; margin: 0;}
h3 + p { text-indent: 0; }

Last edited by Doitsu; 04-07-2015 at 05:23 PM.
Doitsu is offline   Reply With Quote
Old 04-08-2015, 12:09 AM   #5
oenopion
Member
oenopion began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Apr 2015
Device: Kindle, Nook, Android
Doitsu! Thanks, that was a breeze and a big help. I appreciate the replies, and have learned a lot just from seeing how they work. I can see how important the css (and learning it!) is going to be in this project.
oenopion is offline   Reply With Quote
Advert
Old 04-08-2015, 08:57 AM   #6
exaltedwombat
Guru
exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.
 
Posts: 878
Karma: 2457540
Join Date: Nov 2011
Device: none
Or you could use

p {text-indent:0;}

p + p {text-indent:1em;}

That allows for breaks that are delimited other than by h3.
exaltedwombat is offline   Reply With Quote
Old 04-08-2015, 01:34 PM   #7
okletsgo
Junior Member
okletsgo began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Apr 2015
Device: none
Newbie to epub and Sigil

I'm trying to copy and paste a css file into Sigil, but it won't take it. It doesn't even show up on the clipboard history. This is my first experience with the epub world and specifically to Sigil. What am I missing?
okletsgo is offline   Reply With Quote
Old 04-08-2015, 01:49 PM   #8
okletsgo
Junior Member
okletsgo began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Apr 2015
Device: none
Saoved the file as .css instead of .txt and added it to Sigil. It worked.
okletsgo is offline   Reply With Quote
Old 04-08-2015, 02:10 PM   #9
exaltedwombat
Guru
exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.
 
Posts: 878
Karma: 2457540
Join Date: Nov 2011
Device: none
Or you can create a blank stylesheet in Sigil and paste the contents in.
exaltedwombat is offline   Reply With Quote
Old 04-08-2015, 02:12 PM   #10
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: 970
Karma: 4999999
Join Date: Mar 2009
Location: Rosario, Argentina
Device: SONY PRS-505, PRS-T2
Quote:
Originally Posted by okletsgo View Post
This is my first experience with the epub world and specifically to Sigil. What am I missing?
Some time ago I wrote an Epub tutorial for beginners (see my signature for the links). I think you may find it useful.
Pablo is offline   Reply With Quote
Old 04-08-2015, 02:43 PM   #11
oenopion
Member
oenopion began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Apr 2015
Device: Kindle, Nook, Android
Quote:
Originally Posted by exaltedwombat View Post
Or you could use

p {text-indent:0;}

p + p {text-indent:1em;}

That allows for breaks that are delimited other than by h3.
So, if I'm following this, p would be defined as no indent for the default, and p + p would give that particular paragraph an indent? (Though for now, my simple project only needs the no indent after the chapter subheading once for each new chapter)
oenopion is offline   Reply With Quote
Old 04-08-2015, 02:48 PM   #12
oenopion
Member
oenopion began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Apr 2015
Device: Kindle, Nook, Android
Pablo, thanks for posting that link. Your guide is a great help since I only opened Sigil for the first time yesterday. I love how you have both the pdf and epub versions to compare back and forth. I opened your epub in Sigil and can toggle between code and page, which makes learning and understanding so much easier. Nice!
oenopion is offline   Reply With Quote
Old 04-08-2015, 03:03 PM   #13
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
Quote:
Originally Posted by oenopion View Post
So, if I'm following this, p would be defined as no indent for the default, and p + p would give that particular paragraph an indent? (Though for now, my simple project only needs the no indent after the chapter subheading once for each new chapter)
What it actually says, is that a paragraph has no indent by default. However, if a paragraph is directly after another paragraph, that second paragraph must be indented.
So, in that case only the first paragraph would have no indent.
Toxaris is offline   Reply With Quote
Old 04-08-2015, 04:06 PM   #14
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: 970
Karma: 4999999
Join Date: Mar 2009
Location: Rosario, Argentina
Device: SONY PRS-505, PRS-T2
Quote:
Originally Posted by oenopion View Post
Pablo, thanks for posting that link. Your guide is a great help since I only opened Sigil for the first time yesterday. I love how you have both the pdf and epub versions to compare back and forth. I opened your epub in Sigil and can toggle between code and page, which makes learning and understanding so much easier. Nice!
I'm glad you like it!
Pablo is offline   Reply With Quote
Old 04-09-2015, 07:07 AM   #15
exaltedwombat
Guru
exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.
 
Posts: 878
Karma: 2457540
Join Date: Nov 2011
Device: none
Quote:
Originally Posted by oenopion View Post
So, if I'm following this, p would be defined as no indent for the default, and p + p would give that particular paragraph an indent? (Though for now, my simple project only needs the no indent after the chapter subheading once for each new chapter)

Yup. Same idea as the other suggestion, but approached from a different angle.

You can set indent as the default, but make an exception when <p> is preceded by <h3>. Or you can default to no indent, but make an exception when <p> is preceded by another <p> (i.e. for all paragraphs except the first).
exaltedwombat is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
css question ralphiedee Sigil 74 12-23-2012 06:29 AM
CSS Question jackibar Sigil 24 03-01-2012 09:12 AM
CSS question crutledge Workshop 17 12-17-2011 07:52 AM
CSS Question AppleTard Calibre 1 06-12-2011 12:07 AM
Help! Newbie having problems converting HTML/CSS files jackie_w Calibre 6 09-14-2009 04:53 PM


All times are GMT -4. The time now is 11:46 AM.


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