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 03-18-2014, 08:55 PM   #1
bfollowell
Fanatic
bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.
 
Posts: 510
Karma: 1152752
Join Date: Aug 2010
Location: Evansville, IN, USA
Device: Amazon Kindle 3 Wi-Fi & B&N Nook Tablet & B&N Nook HD+
Confusing global definitions in css

I don't know if this is the best place to post this or not. It's more of a coding issue than a Sigil issue so I'm going to try here.

Typically, most css that I edit are mostly made up of various class definitions. I'm try to clean up/improve an epub that only has a couple of class definitions and is made up mostly of global definitions. Here are some examples:

p { margin: 0px 0px 0px 0px; font-family: Times New Roman; }
p + p { text-align: justify; text-indent: 12px; margin-top: 0px; }
p + p b { text-align: justify; text-indent: 12em; margin-top: 0px; }

OK, I know p is paragraph. So all paragraphs with no other class assigned would default to the global p definition.

Now, what are p + p and p + p b and when would they come into play? I've never ran into these before.

Any light anyone could shed into this for me would be greatly appreciated.

Thanks.

- Byron
bfollowell is offline   Reply With Quote
Old 03-18-2014, 09:03 PM   #2
eschwartz
Irrational Optimist
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
Posts: 2,895
Karma: 4212450
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch (Wifi only)
It is an adjacent selector: http://www.w3.org/TR/CSS2/selector.h...ttern-matching

Quote:
E + F -- Matches any F element immediately preceded by a sibling element E.
eschwartz is offline   Reply With Quote
 
Enthusiast
Old 03-18-2014, 09:14 PM   #3
bfollowell
Fanatic
bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.
 
Posts: 510
Karma: 1152752
Join Date: Aug 2010
Location: Evansville, IN, USA
Device: Amazon Kindle 3 Wi-Fi & B&N Nook Tablet & B&N Nook HD+
OK. Gotcha. Thanks!

So p + p would be consecutive paragraphs.

p + p b would be any paragraph with bold characters following a paragraph? That one seems sort of strange but I think that's what it would be.

Thanks for your help.

- Byron
bfollowell is offline   Reply With Quote
Old 03-18-2014, 09:39 PM   #4
eschwartz
Irrational Optimist
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
Posts: 2,895
Karma: 4212450
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch (Wifi only)
Quote:
Originally Posted by bfollowell View Post
OK. Gotcha. Thanks!

So p + p would be consecutive paragraphs.

p + p b would be any paragraph with bold characters following a paragraph? That one seems sort of strange but I think that's what it would be.

Thanks for your help.

- Byron
No, it would refer to the contents of any <b> tag, if it is inside a <p> tag that is immediately followed by another <p> tag.

Try thinking of it as tags, since the fact that <b> creates bold text doesn't have anything to do with the nature of the CSS inheritance.

You can have a <span style="font-weight:bold;">bolded text</span> with, you guessed it, bold characters. "p+p b" would not match a span tag, and these bolded characters would not receive that CSS.

But if the only bolding was done via the <b> tag, it would work as you expect.

Hopefully, this is a little clearer.

Last edited by eschwartz; 03-18-2014 at 11:21 PM. Reason: typo
eschwartz is offline   Reply With Quote
Old 03-18-2014, 11:10 PM   #5
bfollowell
Fanatic
bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.bfollowell ought to be getting tired of karma fortunes by now.
 
Posts: 510
Karma: 1152752
Join Date: Aug 2010
Location: Evansville, IN, USA
Device: Amazon Kindle 3 Wi-Fi & B&N Nook Tablet & B&N Nook HD+
Definitely! Thank you very much for your help. Most of the books that I deal with have pretty standard classes setup, or very simple globals like div, p, img. It's only been recently that I've started to run into these.

I really appreciate your help.

- Byron

Last edited by bfollowell; 03-19-2014 at 02:18 AM.
bfollowell is offline   Reply With Quote
Old 03-18-2014, 11:21 PM   #6
eschwartz
Irrational Optimist
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
Posts: 2,895
Karma: 4212450
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch (Wifi only)
Sure, anytime.
eschwartz is offline   Reply With Quote
Old 03-19-2014, 04:34 AM   #7
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 5,794
Karma: 4027751
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon
Quote:
Originally Posted by bfollowell View Post
OK, I know p is paragraph. So all paragraphs with no other class assigned would default to the global p definition.
All paragraphs, with or without class, will have the global p style applied. Paragraphs with a class or matching some other selector can have additional styles applied (possibly overriding default ones).

p + p applies to any paragraph following a paragraph, but still the basic p applies too, so they are justified and Times New Roman as well.

p + p b applies to any <b> tag inside a <p> following another <p> and, since what this style constains is text-align, text-indent and margin-top, it's pretty useless, because the <b> tag is inline, and those properties have no meaning there.
Jellby is offline   Reply With Quote
Old 03-19-2014, 09:28 AM   #8
mrmikel
Book Twiddler
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 1,707
Karma: 1356799
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
I have some question whether this sort of construction is wise, whether it is permitted or not.

If you have too much stuff cascading it can take some work to figure out what is operating on any given paragraph and it might take some thought to edit the mess too without creating unintended consequences.

If course if Bryon has this stuff incoming, all he can do is duck! (grin)
mrmikel is offline   Reply With Quote
Old 03-19-2014, 09:44 AM   #9
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 5,794
Karma: 4027751
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon
Quote:
Originally Posted by mrmikel View Post
I have some question whether this sort of construction is wise, whether it is permitted or not.
I would reduce it to:

Code:
p { margin: 0; text-indent: 1.5em; text-align: justify; }
h1 + p { text-indent: 0; }
- For goodness' sake, do not force a base font.
- I'm sure you want justification in the first paragraph too.
- No need to set margin-top again, when the margin was already set before.
- Rather than having a special selector for when you want indents, have one for when you don't want them (h1+p, as an example). With p+p you don't get indents in a <p> after a <div class="illustration">.

Ideally, you wouldn't even specify margins or text-align (maybe not even text-indent:1.5em), that should be set by the reader.
Jellby is offline   Reply With Quote
Old 03-19-2014, 08:58 PM   #10
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 1,317
Karma: 846401
Join Date: Jan 2009
Device: KoboGlo
Quote:
Originally Posted by eschwartz View Post
Using pattern matching in a stylesheet is an efficient - and elegant - thing to do. A pity few converters make good use of it...

Quote:
Originally Posted by Jellby View Post
.../...
- For goodness' sake, do not force a base font..../...
I would say it a little differently. I propose: " Do not name a base font without providing an easy way out". I think that any reader worth this name can change easily a base font if it's only named once in the body. I have two reasons for doing so:

1. - Not all the fonts provide "espaces fines" (nnbsp) even if readers using ADE 2.0 and above can read them automatically. So, I have been used to provide one font that does it as a base font. I'll add it as an attribute in the body once for all.

There is a draw back that I heard of: some few ebook-readers - like the Nook I think? - do not recognize such an attribute in this place, but I think it's valid and standard compliant code, so I just do not pay it more attention than to some iBooks quirks (To be true, I sell nothing ).

2. - The other reason is that I like to provide PDF too (using a very nice Jellby's script) straight from my EPUB. For PDF, it's better to provide a base font because it will do nothing on its own.

Last edited by roger64; 03-20-2014 at 12:11 AM.
roger64 is offline   Reply With Quote
Old 03-20-2014, 08:11 AM   #11
mrmikel
Book Twiddler
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 1,707
Karma: 1356799
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
I sell nothing either. The commercial ebook world is a much less pleasant place full of mutually exclusive/contradictory/.... requirements. I have no one to please but myself, but try to think of the users of the books I transcribe.
mrmikel is offline   Reply With Quote
Old 03-20-2014, 10:05 AM   #12
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: 8,313
Karma: 36123946
Join Date: Jan 2010
Device: Kindle Fire HD, Kindle 2
When I create an ebook (and I don't do it commercially at all), I do so with the assumption that some future disaster will result in the loss of massive amounts of literature (both physical AND digital) that can only be "reclaimed" from personal archives. So when they eventually discover that box full of thumbdrives in the ruins of my home, they will be amazed by the trove of simple, clean, complete, and easy-to-edit/convert representations of lost treasures that they find there.
DiapDealer is offline   Reply With Quote
Old 03-20-2014, 06:41 PM   #13
Tex2002ans
Addict
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 355
Karma: 238567
Join Date: Jul 2012
Device: Nook
Quote:
Originally Posted by DiapDealer View Post
When I create an ebook (and I don't do it commercially at all), I do so with the assumption that some future disaster will result in the loss of massive amounts of literature (both physical AND digital) that can only be "reclaimed" from personal archives. So when they eventually discover that box full of thumbdrives in the ruins of my home, they will be amazed by the trove of simple, clean, complete, and easy-to-edit/convert representations of lost treasures that they find there.


This is the proper way to think! Clean the books as best as you can, with as minimal/clean code as possible, to the best of your ability.

I look back on a few of my earlier EPUBs, and I just think "wow, that is bad" or "what the hell was I thinking?"

Example: Avoid captions in images LIKE THE PLAGUE.
Example: Try to avoid lossy conversions (JPG), and keep things in lossless if you can (PNG). Once you go lossy, you can never go back!

My main goal is digitizing works which are only in scans (or not online at all), a subgoal is "maintenance" of the ebook backlog... continually going back and fixing up the old code to match my newest standards.... a lot like any large programming project!

Or think of it this way, even IF you are creating these books "only for yourself", you will be converting these books to future formats and be your own "customer/reader/user" ten years down the line. I try to stress this to others here too, you will save yourself a lot of future headaches if you try to make it RIGHT the FIRST time.

Last edited by Tex2002ans; 03-20-2014 at 06:45 PM.
Tex2002ans is offline   Reply With Quote
Old 03-23-2014, 07:29 AM   #14
mrmikel
Book Twiddler
mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.mrmikel ought to be getting tired of karma fortunes by now.
 
Posts: 1,707
Karma: 1356799
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
You're doing it commercially, Tex2002ans.

For me, not everything worth doing is worth doing perfectly. Getting it good enough to read and enjoy is good enough. Links to and from footnotes etc. are more trouble than they are worth to me.
mrmikel is offline   Reply With Quote
Old 03-23-2014, 09:21 PM   #15
Tex2002ans
Addict
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 355
Karma: 238567
Join Date: Jul 2012
Device: Nook
Quote:
Originally Posted by mrmikel View Post
For me, not everything worth doing is worth doing perfectly. Getting it good enough to read and enjoy is good enough. Links to and from footnotes etc. are more trouble than they are worth to me.
I am telling you... ten years down the line, you will want to create some beautiful new ebooks/PDFs/whatever format out of your converted books, and then you will curse your "ten years ago" self.

Example: One of my other side projects is "redoing" a lot of the books that were previously converted by an Indian conversion company. They use spaghetti code + hideous code + unmaintainable junk. Sure, it may LOOK pretty, and work ok FOR NOW in EPUB/current devices. But when the next ebook generation comes along, I bet you these books will break and be a complete pain to transfer over.

Anyway... sort of getting side-tracked from the main post.

Last edited by Tex2002ans; 03-23-2014 at 09:28 PM.
Tex2002ans 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
sigil_split_marker and other CSS definitions; where are they? rceee Sigil 6 03-10-2013 08:25 PM
Arc confusing stevov Kobo Tablets 1 01-12-2013 04:58 PM
Global css triplemaya Sigil 9 12-04-2011 07:17 PM
How to maintain a global CSS stylesheet amoroso Sigil 7 07-18-2010 08:37 PM


All times are GMT -4. The time now is 04:33 AM.


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