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 05-13-2019, 09:41 PM   #1
lumpynose
Addict
lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.
 
Posts: 302
Karma: 1064114
Join Date: Jul 2012
Device: eBookMan EBM-900
confused about style inheritance

I thought that styling applied to upper level tags was inherited by tags that were enclosed in them. E.g., any styling on the html tag would be inherited by the body tag and/or any styling on the body tag would be inherited by the p tags. But that doesn't seem to be the case. My css file contains

Code:
body {
    font-size: 100%;
    border-bottom: 0;
    border-top: 0;
    margin-bottom: 0;
    margin-top: 0;
    padding-bottom: 0;
    padding-top: 0;
}
p {
    display: block;
    font-size: 1em;
    text-indent: 1.5em;
    text-align: left;
}
But Sigil's previewer is not using them; you can see that they're lighter in this screen capture and have lines through them, while Calibre's editor doesn't show the lighter ones and does show the line through the font-size.

Click image for larger version

Name:	sigil inspector.jpg
Views:	42
Size:	93.0 KB
ID:	171447

Can someone explain to me what's going on?
lumpynose is offline   Reply With Quote
Old 05-13-2019, 10:16 PM   #2
jhowell
Wizard
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 2,778
Karma: 25999999
Join Date: Nov 2011
Location: Florida
Device: Oasis 2, Fire, iPad Air 2, Nexus 7
It is more complicated than you think. Read a CSS tutorial.

Margins and padding are not inherited.

Font-size can be inherited. 100% means make it the same as its parent element’s font size, which is the default anyway.

Last edited by jhowell; 05-13-2019 at 10:21 PM.
jhowell is offline   Reply With Quote
Old 05-13-2019, 10:19 PM   #3
lumpynose
Addict
lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.
 
Posts: 302
Karma: 1064114
Join Date: Jul 2012
Device: eBookMan EBM-900
Quote:
Originally Posted by jhowell View Post
It is more complicated than you think. Read a CSS tutorial.
Ugh, ok.
lumpynose is offline   Reply With Quote
Old 05-13-2019, 10:37 PM   #4
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: 1,760
Karma: 11819190
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone X/6/iPad 1,2 & Air/Surface Pro/Kindle PW
Hi,

Generally, when you define an element like you did, you are defining each element's attributes (it's box model: margin, border, padding, etc.). You are not defining it's child element's. If you want a specific attribute to inherit from it's parent you need to set it to 'inherit'.

eg.
Code:
p {color: inherit}
Here is a link to a better explanation of inheritance.

Having said that, when you set the body font-size to 100% your are setting the baseline font size for the document. When you then define font-size within a child element using EMs then that is relative to the font-size you set in the body. Clear as mud?
1em = 1 times the size you set in body
1.2em = 1.2 times the size you set in the body
2em = 2 times, etc.

That way, when a browser/reader/app changes the overall font size, then each font remains the same size relative to each other, ie the header will still stay 1.2 times the size of the normal paragraph font size if you used the following css:

Code:
body {font-size: 100%; margin: 0; padding: 0; border: 0}
h1   {font-size: 1.2em; font-weight: bold}
p    {font-size: 1em}
Turtle91 is offline   Reply With Quote
Old 05-14-2019, 12:03 AM   #5
lumpynose
Addict
lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.
 
Posts: 302
Karma: 1064114
Join Date: Jul 2012
Device: eBookMan EBM-900
Ok, thanks. So it sounds like what some people have said in this thread isn't correct:

https://www.mobileread.com/forums/sh...d.php?t=316965
lumpynose is offline   Reply With Quote
Old 05-14-2019, 01:26 AM   #6
lumpynose
Addict
lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.
 
Posts: 302
Karma: 1064114
Join Date: Jul 2012
Device: eBookMan EBM-900
Here's a nice page on inheritance:

https://webplatform.github.io/docs/t...e_and_cascade/
lumpynose is offline   Reply With Quote
Old 05-14-2019, 08:08 AM   #7
jhowell
Wizard
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 2,778
Karma: 25999999
Join Date: Nov 2011
Location: Florida
Device: Oasis 2, Fire, iPad Air 2, Nexus 7
Quote:
Originally Posted by Turtle91 View Post
1em = 1 times the size you set in body
1.2em = 1.2 times the size you set in the body
2em = 2 times, etc.
Technically em units are relative to the element's parent, which is not always the body element.
jhowell is offline   Reply With Quote
Old 05-14-2019, 08:15 AM   #8
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: 1,760
Karma: 11819190
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone X/6/iPad 1,2 & Air/Surface Pro/Kindle PW
Quote:
Originally Posted by jhowell View Post
Technically em units are relative to the element's parent, which is not always the body element.
Valid. In the example the body was the parent, but it doesn't have to be.
Turtle91 is offline   Reply With Quote
Old 05-14-2019, 10:07 AM   #9
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: 1,760
Karma: 11819190
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone X/6/iPad 1,2 & Air/Surface Pro/Kindle PW
Quote:
Originally Posted by lumpynose View Post
Ok, thanks. So it sounds like what some people have said in this thread isn't correct:

https://www.mobileread.com/forums/sh...d.php?t=316965
Hi lumpynose,

There was a lot of discussion in that thread about how to fix a specific rendering issue with a specific piece of software using negative margins. Be careful when using someone's work-around as a template for all styling! lolz
Turtle91 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
Style Sheet entry for a 'hanging' style AThirstyMind Kindle Formats 6 12-10-2016 12:28 AM
Christopher Paolini, Inheritance Cycle Joy736 Reading Recommendations 8 02-04-2012 07:28 PM
Inheritance 4 Paolini, no ePub books? mclien General Discussions 27 11-13-2011 10:46 AM
Mobi TOC style vs ePub style? phearlez Kindle Formats 3 04-11-2010 06:35 AM
Brisingr/Inheritance discussion (spoilers) nekokami Reading Recommendations 6 01-15-2009 10:22 AM


All times are GMT -4. The time now is 12:18 AM.


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