"titled-section" bleeding font size or "emphasis" wrong font size

I just started a new document and compiled it with the default ebook format for epub 3 to preview it. I noticed the sections with the style of “Emphasis” had a larger font size than the rest of the text.

It is easy to fix by editing the format, but I’m a bit puzzled why the default would come out like that.

Looking into the html that is produced, I see that both “chapter-title” and “titled-section” set a font size of 0.92rem, while “emphasis” sets 1rem. “body” also sets 1rem, but “chapter-title” and “titled-section” sit directly inside the body tag and span the whole document, rendering that moot.

My first thought was that those were intended to only span the tite part and not the text, but now I’m not sure about that. Another theory would be that those sizes were originally “em” (relative to the parent element) and then changed to “rem” (absolute) without changing the way they are used. But then, why set the font size for everything to 92% of what the user has set their eReader to in the beginning? That’s a bit rude, in my opinion.

Um…what is going on here?

And on an unrelated note, <em><span class="emphasis">... seems a bit redundant.

Nobody?

Anyway, I ran into this again. When I create a character style, without checking keep font/font size anywhere, and even having it at the same font size in Format->Styles as the default formatting, it comes out having another text size as text with no style applied.

The issue is that the css is generated as

.stylename { font-size: 1.00rem; font-weight: normal; }

The “rem” there is nonsense. It resets the text size to the document default, ignoring the size of the paragraph and chapter it is in. (Also, there shouldn’t be any text size or font weight there at all, as none has been set in the style, but when it’s there it should be correct.)

Manually correcting this isn’t easy, as I see no clean way to do this in the dialogs without typing in css manually. I have to copy the style settings from:

.titled-section { margin: 0rem 0rem 0rem 0rem; text-indent: 0rem; font-size: 0.92rem; font-weight: normal; } 

manually to each and style that creates a css class. And that then may blow up in my face if I use another section layout that may have another default.

What’s that obsession with rem anyway? It has its uses, sure, but em, which is relative to the containing element, is the right one in most cases. That’s especially true for character styles, those should always be relative to the surrounding unstyled text.

No, XHTML from Scrivener is not clean. I use Regular Expressions heavily correcting the output. It allows for finding and removing excess elements, without changing the actual content.

The process using MMD and Pandoc is said to create clean XHTML, but thats a whole other ballpark…

Rem is supposed to be relative to the default formatting, isn’t it? I prefer em too, but this is what you get from the Scrivener Stylesheet.

1 Like

Relative to the size on the document, if I remember it correctly. I looked it up when I made the first post. Using rem is nice for e.g. margins that should always be the same no matter ow deep inside other tags you are, but when the font size for everything is scaled down to 92% with a div that encloses everything, setting a font size of 100% relative to document instead of parent gives you garbage.

BTW, here’s an example. I made that screenshot earlier to demonstrate the nice prefixing feature, but it also shows the font size issue:

Those styles do not have “keep font size” checked, neither in the style definition nor the style page of the format used. Yet they render as “ignore that the whole chapter is at 92% as make us 100%”.