Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 03-19-2013, 08:23 AM   #1
Alda
Zealot
Alda began at the beginning.
 
Posts: 104
Karma: 22
Join Date: Jun 2010
Device: none
Help with css formatting - first line indent

Hello,

The stylesheet I'm using indents the first line of every paragraph - which is great. However, I want the first line of each chapter and after section dividers NOT to indent. I can't do it by simply backspacing, so can anyone help with a css code that would help me do that?

Thanks!
Alda is offline   Reply With Quote
Old 03-19-2013, 08:44 AM   #2
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,093
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
You can either give each paragraph a special class with appropriate formatting, or use a little more technical CSS styling and it will do it automatically.

Code:
.noind {text-indent:0}

<p class="noind">This is a no indent paragraph.</p>
Or

Code:
.sectionbreak {margin:2em auto; text-align:center}

h2 + p, p.sectionbreak + p {text-indent:0}
Where the first paragraph which immediately follows an h2 tag,
or a paragraph defined as a section break,
will have an indent of 0

As in:
<h2>Chapter 69</h2>
<p>This is a no indent paragraph.</p>

<p class="sectionbreak">* * *</p>
<p>This is a no indent paragraph.</p>


I hope that helps!

Cheers,
Turtle91 is offline   Reply With Quote
Old 03-19-2013, 08:44 AM   #3
ghostyjack
Guru
ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.
 
ghostyjack's Avatar
 
Posts: 718
Karma: 1085610
Join Date: Mar 2009
Location: Bristol, England
Device: PRS-T1, 1825PT, Galaxy Tab, One X, TF700T, Aura HD, Nexus 7
I normally use soothing like this:

Code:
<p class="newscene1">blah, blah, blah.</p>

<p>blah, blah, blah.</p>

<p>blah, blah, blah.</p>
With the CSS being:

Code:
p      {text-indent:1em;
         margin:0;}
.newscene1 {text-indent:0;
         margin-top:1em;}
This gives a default indent to all paragraphs and no space between the paragraphs of the scene. And "newscene1" is what I use for a scene break as it removes the indent and add a single line space from the previous paragraph.

Last edited by ghostyjack; 03-19-2013 at 08:47 AM.
ghostyjack is offline   Reply With Quote
Old 03-19-2013, 08:48 AM   #4
ghostyjack
Guru
ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.
 
ghostyjack's Avatar
 
Posts: 718
Karma: 1085610
Join Date: Mar 2009
Location: Bristol, England
Device: PRS-T1, 1825PT, Galaxy Tab, One X, TF700T, Aura HD, Nexus 7
You beat me to it!

Both approaches work, just depends on what you prefer.

For the start of chapters, I tend to add another "newscene" entry I call "newscene2", this one had margin-top set to 2em instead of 1em. Thus providing a bit more gap to the chapter heading.
ghostyjack is offline   Reply With Quote
Old 03-19-2013, 09:07 AM   #5
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,093
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
That thar is called "ninja typing skills"!!
Turtle91 is offline   Reply With Quote
Old 03-19-2013, 09:42 AM   #6
Alda
Zealot
Alda began at the beginning.
 
Posts: 104
Karma: 22
Join Date: Jun 2010
Device: none
Thanks you guys!

@Turtle91 - I presume your second code works just as well if I call it h1 instead of h2?

@ghostyjack - to make yours work, you would have to manually go into the code and assign each paragraph the "newscene" marker, no?

Also, is there a quick way to assign a class to a section break?

ps - This is such a great forum.
Alda is offline   Reply With Quote
Old 03-19-2013, 09:55 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: 29,775
Karma: 54401244
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 Alda View Post
Thanks you guys!

@Turtle91 - I presume your second code works just as well if I call it h1 instead of h2?

@ghostyjack - to make yours work, you would have to manually go into the code and assign each paragraph the "newscene" marker, no?

Also, is there a quick way to assign a class to a section break?

ps - This is such a great forum.

Search and Replace: REGEX (a Normal mode might have problem because of the Stars)

Code:
<p>\*\s*\*\s*\*</p>
<p class="sectionbreak">* * *</p>
I used \s* (zero or more white space) between the stars
The REAL stars need to be escaped on search ONLY as they are special characters
theducks is online now   Reply With Quote
Old 03-19-2013, 01:44 PM   #8
ghostyjack
Guru
ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.ghostyjack ought to be getting tired of karma fortunes by now.
 
ghostyjack's Avatar
 
Posts: 718
Karma: 1085610
Join Date: Mar 2009
Location: Bristol, England
Device: PRS-T1, 1825PT, Galaxy Tab, One X, TF700T, Aura HD, Nexus 7
Quote:
Originally Posted by Alda View Post
@ghostyjack - to make yours work, you would have to manually go into the code and assign each paragraph the "newscene" marker, no?
The standard paragraph tag will always be indented with the code I showed above, so you only need to add the "newscene" classes when you want to have the paragraph behave differently.
ghostyjack is offline   Reply With Quote
Old 03-19-2013, 06:09 PM   #9
Alda
Zealot
Alda began at the beginning.
 
Posts: 104
Karma: 22
Join Date: Jun 2010
Device: none
Absolutely awesome. I now have it just the way I wanted. Thanks so much.
Alda is offline   Reply With Quote
Old 03-20-2013, 09:46 AM   #10
phossler
Wizard
phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.phossler ought to be getting tired of karma fortunes by now.
 
Posts: 1,071
Karma: 412718
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
@Turtle91 -- I didn't know you could do that in CSS

Code:
.sectionbreak {margin:2em auto; text-align:center}

h2 + p, p.sectionbreak + p {text-indent:0}
It'll come in handy

Paul
phossler is offline   Reply With Quote
Old 03-20-2013, 10:21 AM   #11
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: 696
Karma: 150000
Join Date: Feb 2010
Device: none
Kind of off topic for this forum, but keep in mind that some of these CSS constructs may not translate well to Kindle format via kindlegen (IIRC).
st_albert is offline   Reply With Quote
Old 03-22-2013, 05:24 AM   #12
Alda
Zealot
Alda began at the beginning.
 
Posts: 104
Karma: 22
Join Date: Jun 2010
Device: none
I did find that when trying to upload an ePub to the KDP platform. The workaround was to convert it first to .mobi using Calibre, then uploading again. That worked like a charm.
Alda is offline   Reply With Quote
Reply

Tags
first line indent, no indent

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Mobi files and Kindle's first line indent eggheadbooks1 Kindle Formats 7 06-16-2011 08:21 PM
CSS override working for font, not dd indent FlaSheridn Calibre 3 10-31-2010 03:06 PM
Specify indent in css, not with &nbsp James_Wilde Calibre 7 09-13-2010 09:48 PM
CSS wacky p indent post-chapter split? Hitch Sigil 0 06-17-2010 08:59 PM
First Line indent for Mobi conversion tbergman Calibre 7 09-06-2009 09:09 AM


All times are GMT -4. The time now is 01:25 PM.


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