Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 03-03-2020, 07:31 PM   #16
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,295
Karma: 1436993
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by rjwse@aol.com View Post
<body>
<h2>text</h2>
<ol>text</ol>
<p>text</p>
<h2>text</h2>
<img />
<p>text</p>
</body>

h2 ~ p:first-of-type{} will change only first p.
(h2 ~ p):first-of-type {} would change all p's (it's a 'reset') but css does not allow.
Instead, add class="h" to all H2s and
.h ~ p:first-of-type {} and this will change both p's.
no such thing as first-of-class either.
The other way to accomplish both p's being changed is to split the xhtml segment into two to isolate the H2s.

Shazam!

If we think of real books, it is common to see a certain pattern for headings. So, you could use something like this to create dropcaps, without using classes:

Code:
h1 + p::first-letter {
  font-size: 3.5em;
  float: left;
  line-height: 1em;
  margin-bottom: -0.284em;
  margin-right: 0.05em;
  margin-top: -0.16em;
}
If you have something else after the h1, maybe an hr, or an img, just add it:

Code:
h1 + hr + p::first-letter {
  css code here
}
This would work on multiple h2 on a single file either, as long as they all follow the pattern.
Attached Thumbnails
Click image for larger version

Name:	dropcap.png
Views:	167
Size:	81.5 KB
ID:	177491   Click image for larger version

Name:	dropcap1.png
Views:	158
Size:	82.5 KB
ID:	177492  
thiago.eec is offline   Reply With Quote
Old 03-03-2020, 09:44 PM   #17
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 337
Karma: 2267708
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
I find it very easy to use Regex to find and replace all first letters at the beginning of each chapter.
................
That sounds good. Can you share?
rjwse@aol.com is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Would these dropcaps work for Kindle formats? Klip Kindle Formats 0 04-11-2014 03:30 AM
Alphabet for DropCaps crutledge Workshop 23 12-05-2013 04:34 PM
AZW3 and dropcaps Jeff L Conversion 9 01-21-2013 10:12 PM
Dropcaps code wanted JSWolf ePub 22 09-19-2012 03:31 AM
CSS / dropcaps Oldpilot Sigil 49 09-17-2012 10:44 AM


All times are GMT -4. The time now is 06:34 PM.


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