|
|
#1 |
|
Connoisseur
![]() Posts: 70
Karma: 22
Join Date: Jun 2010
Device: none
|
Help with css formatting - first line indent
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! |
|
|
|
|
|
#2 |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 546
Karma: 2178910
Join Date: Dec 2012
Location: Bangkok, Thailand today
Device: iPhone 5/iPad 1&2/Surface Pro/Kindle PW
|
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>
Code:
.sectionbreak {margin:2em auto; text-align:center}
h2 + p, p.sectionbreak + p {text-indent:0}
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,
__________________
Dion "Gnihcnip" - the act of "reverse pinching" to expand/zoom. Pronounced "Niknip" (the "g" and "h" are silent). "Live long and prosper." ~ Spock "What's that goat doing up in the clouds? " ~ Pilot
|
|
|
|
|
Enthusiast
|
|
|
|
#3 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 679
Karma: 1085478
Join Date: Mar 2009
Location: Bristol, England
Device: PRS-600, Acer 1825PT, Galaxy Tab, PRS-T1, HTC One X, TF700T
|
I normally use soothing like this:
Code:
<p class="newscene1">blah, blah, blah.</p> <p>blah, blah, blah.</p> <p>blah, blah, blah.</p> Code:
p {text-indent:1em;
margin:0;}
.newscene1 {text-indent:0;
margin-top:1em;}
__________________
Get 5GB of online storage for free from SugarSync. Click here for an additional 500MB to give you 5.5GB for free. Always have your stuff when you need it with @Dropbox. 2GB account is free! Click here Currently working on updating some of my Lovecraft work after receiving some corrections Last edited by ghostyjack; 03-19-2013 at 08:47 AM. |
|
|
|
|
|
#4 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 679
Karma: 1085478
Join Date: Mar 2009
Location: Bristol, England
Device: PRS-600, Acer 1825PT, Galaxy Tab, PRS-T1, HTC One X, TF700T
|
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.
__________________
Get 5GB of online storage for free from SugarSync. Click here for an additional 500MB to give you 5.5GB for free. Always have your stuff when you need it with @Dropbox. 2GB account is free! Click here Currently working on updating some of my Lovecraft work after receiving some corrections |
|
|
|
|
|
#5 |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 546
Karma: 2178910
Join Date: Dec 2012
Location: Bangkok, Thailand today
Device: iPhone 5/iPad 1&2/Surface Pro/Kindle PW
|
That thar is called "ninja typing skills"!!
__________________
Dion "Gnihcnip" - the act of "reverse pinching" to expand/zoom. Pronounced "Niknip" (the "g" and "h" are silent). "Live long and prosper." ~ Spock "What's that goat doing up in the clouds? " ~ Pilot
|
|
|
|
|
|
#6 |
|
Connoisseur
![]() Posts: 70
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.
|
|
|
|
|
|
#7 | |
|
Staff to 4 Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 10,725
Karma: 2485850
Join Date: Aug 2009
Location: The (original) Silicon Valley, USA
Device: Galaxy Tab 2,Black Astak PEz, K4NT(now Wifes)
|
Quote:
Search and Replace: REGEX (a Normal mode might have problem because of the Stars)Code:
<p>\*\s*\*\s*\*</p> <p class="sectionbreak">* * *</p> The REAL stars need to be escaped on search ONLY as they are special characters
__________________
Using: Ubuntu(32 bit):Oneric,Precise and XPpro SP3, W7HP(64)- - Libre Office w/Writer2EPUB
|
|
|
|
|
|
|
#8 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 679
Karma: 1085478
Join Date: Mar 2009
Location: Bristol, England
Device: PRS-600, Acer 1825PT, Galaxy Tab, PRS-T1, HTC One X, TF700T
|
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.
__________________
Get 5GB of online storage for free from SugarSync. Click here for an additional 500MB to give you 5.5GB for free. Always have your stuff when you need it with @Dropbox. 2GB account is free! Click here Currently working on updating some of my Lovecraft work after receiving some corrections |
|
|
|
|
|
#9 |
|
Connoisseur
![]() Posts: 70
Karma: 22
Join Date: Jun 2010
Device: none
|
Absolutely awesome. I now have it just the way I wanted. Thanks so much.
|
|
|
|
|
|
#10 |
|
Connoisseur
![]() Posts: 82
Karma: 10
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: kindle
|
@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}
Paul |
|
|
|
|
|
#11 |
|
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 432
Karma: 22676
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).
|
|
|
|
|
|
#12 |
|
Connoisseur
![]() Posts: 70
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.
|
|
|
|
![]() |
| Tags |
| first line indent, no indent |
| Thread Tools | Search this Thread |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| New Mobi files and Kindle's first line indent | eggheadbooks1 | Mobi | 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   | 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 |