![]() |
#61 | |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
Quote:
So I have this for my titles: Code:
h1 { text-align: center; padding-bottom: 70px; padding-top: 10px; font-family: "Libre Baskerville", serif; font-size: 2em; } .subtitel { padding-top: 30px; display: block; } .subsubtitel { display: block; padding-top: 30px; font-size: 1em; font-weight: normal; } Code:
<h1>chapternumber <span class="subtitel">subtitel same size as chapternumber</span> <span class="subsubtitel">subsubtitel that should be smaller</span> </h1> How is this possible? I set the font-size for h1 to 2em. |
|
![]() |
![]() |
![]() |
#62 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,625
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Quote:
Sure. I'll do it. Thanks for the tip |
|
![]() |
![]() |
Advert | |
|
![]() |
#63 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,556
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
So your are setting h1 to have a font size twice as big as the default, fine. Everything inside h1, including both spans will now have this large font. Now you set span.subsubtitle to have 100% of its current size, which is already large, and of course 100% leaves that unchanged. If you want span.subsubtitel to have the same size as the normal text, you have to "undo" the scaling, and set the font size to 0.5em (or 50%), that should cancel the 2em in h1. But if you change the h1 size, you have to change this again, because the size is relative to h1, not relative to the main text. Was that semi-clear? |
|
![]() |
![]() |
![]() |
#64 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 206
Karma: 547516
Join Date: Mar 2008
Location: Berlin, Germany
Device: KObo Clara, Kobo Aura, PRS-T1, PB602, CyBook Gen3
|
The font size in html/css is set relative if you use either em or percent.
1em = 100% 2em = 200% The value always changes the font size given by the parent. If no font size is given, the font size of the parents parent is used. Somewhere in either your css or the cs f the reading software a font size is given in px or pt. That is font size all relative font sizes are based on. In your example let say the base font size of your epub is 14pt. In h1 you change it to 2em = 200%. The font size of the heading 1 becomes 28pt (14*2). The font size of .subtitle is not changed so it inherits the font size of its parent the h1 class. The class .subsubtitle has a set font size of 1em = 100% which means 1 time the font size of its parent h1 (28 * 1). To make the font size smaller, you will have to use an em value smaller that 1. |
![]() |
![]() |
![]() |
#65 |
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
I suspected that this would be the 'problem'. Thanks for clearing that up for me!
|
![]() |
![]() |
Advert | |
|
![]() |
Tags |
css, epub, font-size, headings |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem changing font size using font size key | Waylander | Conversion | 0 | 10-02-2013 03:30 PM |
Determine font and font size on incoming epub? | peaceridge | Calibre | 4 | 01-30-2012 03:35 PM |
PRS-300 Med font size too big, but small font size too small | eli2k | Sony Reader | 4 | 05-28-2010 09:47 AM |
Different font for headings | bremler | ePub | 4 | 03-11-2010 06:03 AM |