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

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 06-17-2016, 02:49 AM   #1
AlexBell
Wizard
AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.
 
AlexBell's Avatar
 
Posts: 2,814
Karma: 6491268
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad mini, Lenovo 2 A7 tablet
Setting first line of a blockquote or div

I often set the first paragraph of a blockquote to the left - (text-indent: 0)

Is the CSS which I can apply to the blockquote so that the first paragraph in it is not indented?

It's easy to ensure that the first paragraph after a blockquote is not indented, but I'm talking about the first paragraph within the blockquote.
AlexBell is offline   Reply With Quote
Old 06-17-2016, 03:32 AM   #2
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
Posts: 611
Karma: 1623024
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
Quote:
Originally Posted by AlexBell View Post
I often set the first paragraph of a blockquote to the left - (text-indent: 0)

Is the CSS which I can apply to the blockquote so that the first paragraph in it is not indented?

It's easy to ensure that the first paragraph after a blockquote is not indented, but I'm talking about the first paragraph within the blockquote.

You mean like this?

Code:
// Make first paragraph directly enclosed by blockquote be flush left.
blockquote > p {
    text-indent: 0;
}

// Make subsequent paragraphs directly enclosed by blockquote be
// indented as usual.
blockquote > p + p {
    text-indent: 2em; // or whatever
}
The > selector is the child selector, matching the p tag when it is immediately inside the blockquote tag. Or if you remove that selector and replace it with just whitespace, the rule applies to any p tag that's a descendant of the blockquote tag.

The + selector is the next sibling selector, matching the p tag when it is immediately after another p tag. Or use the ~ selector if your reading system supports it, but that isn't guaranteed in EPUB-2-based readers.

If you know that the paragraph tag will be the first child of its parent, you could also do:

Code:
// Make most paragraphs directly enclosed by blockquote be
// indented as usual.
blockquote > p {
    text-indent: 2em; // or whatever
}

// Make first paragraph directly enclosed by blockquote be flush left.
blockquote > p:first-child {
    text-indent: 0;
}
That approach has the approach of working correctly without the need to add more rules if you have non-p tags inside the blockquote tag, but the disadvantage of not modifying the p tag if there are other tags before it. Then again, if there are other tags before it, you could probably just use those with the + selector instead, so....

Last edited by dgatwood; 06-17-2016 at 03:46 AM.
dgatwood is offline   Reply With Quote
Old 06-19-2016, 08:21 AM   #3
AlexBell
Wizard
AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.AlexBell ought to be getting tired of karma fortunes by now.
 
AlexBell's Avatar
 
Posts: 2,814
Karma: 6491268
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad mini, Lenovo 2 A7 tablet
Thanks, that's most helpful.
AlexBell is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
setting line-height between paragraphs of poetry in epubs Derek R ePub 12 03-14-2013 04:38 AM
calibredb command line question (setting metadata) mezme Calibre 0 12-06-2011 12:17 AM
Feature Request: configurable space setting for "Insert blank line" in "Look & Feel" therealjoeblow Calibre 15 07-25-2011 03:14 PM
Thinking of setting up on line ereader shop and want some advice! Xiaopanda Which one should I buy? 6 05-26-2009 07:48 PM
Line indents using "<div>" tags HarryT Kindle Formats 11 04-29-2009 10:18 PM


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


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