![]() |
#1 |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,582
Karma: 14328510
Join Date: Nov 2019
Device: none
|
h? font size adjusting
In my html I have
Code:
<h2>One <span>Old Man Arlo’s dogs</span></h2> Code:
h2 span { display: block; font-size: larger; } |
![]() |
![]() |
![]() |
#2 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,123
Karma: 144284184
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Code:
<h2>One <span class="h2">Old Man Arlo’s dogs</span></h2> Code:
.h2 { font-size: larger; } |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,582
Karma: 14328510
Join Date: Nov 2019
Device: none
|
The current css is doing that, but without the class on the span. The current css is using the "h2 span" combinator which matches spans inside an h2. I'm getting the larger part and I want to make the h2 text even smaller.
Last edited by hobnail; 06-15-2020 at 12:46 PM. |
![]() |
![]() |
![]() |
#4 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
My suggestion: don't rely on "whatever size it uses" being anything reasonable, set what you want, but in relative terms, e.g.: Code:
h2 { font-size: 100% } h2 span { font-size: 120% } Or maybe what you really want is: Code:
<h2><span class="number">One</span><span class="title">Old Man Arlo’s dogs</span></h2> h2 span.number{ font-size: smaller } h2 span.title { font-size: larger } Code:
<h2>One <span><span>Old Man Arlo’s dogs</span></span></h2> h2 { font-size: smaller } h2 span { font-size: larger } |
|
![]() |
![]() |
![]() |
#5 | |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,582
Karma: 14328510
Join Date: Nov 2019
Device: none
|
Quote:
I like this idea; thanks. I have an add-on css file for these books that have two lines for the chapter title, the ones where the h2 has a span in it. The add-on css file overrides stuff in the main css file. In the add-on I could use whatever percentages work for me. Last edited by hobnail; 06-15-2020 at 01:19 PM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,123
Karma: 144284184
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
H1 = 2em
H2 = 1.5em h3 = 1.17em h4 = 1em h5 = 0.83em h6 = 0.67em Those are the default sizes that h? should be. As to what you want, that can be set in CSS. A CSS size of 100% is meaningless as that's 100% of the default size for that program. If you use font-size: 1.5em; you get the correct default size. The other thing you could do if you want smaller is to use <h3> instead of <h2>. |
![]() |
![]() |
![]() |
#7 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
I could be wrong, but no, it's 100% of the font size of the parent element (which will probably be <body>), so it's effectively the same as 1.00em, but far more understandable, in my opinion.
|
![]() |
![]() |
![]() |
#8 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,123
Karma: 144284184
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
IMHO, 100% is not as understandable as you have to know what the the what the 100% is 100% of. If you use 1em as the font size, you know it's 1em. So 120% would be 20% larger then 100%, but you still don't know what 100% translates to so how would you know what 120% is other then 20% larger then 100%? |
|
![]() |
![]() |
![]() |
#9 | |
Running with scissors
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,582
Karma: 14328510
Join Date: Nov 2019
Device: none
|
Quote:
https://friendsofepub.github.io/eBookTricks/ Somewhere on there he recommends for the body tag font-size:100%. |
|
![]() |
![]() |
![]() |
#10 | ||
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#11 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
|
|
![]() |
![]() |
![]() |
#12 | |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,123
Karma: 144284184
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Add line-height to body <-- ignore this or you ruin the line height slider for Kobo. Don’t define a line-height value which is less than 1.2 <-- KF8 will ignore any line height less then 1.2. It's best to not specify a line height for Kindle eBooks. Disable hyphens <--- ignore that as hyphens should be left on. Declare text-align for elements which should be left-aligned <-- use left align sparingly or not at all Prevent sub- and superscript from affecting line-height <-- You aren't specifying line height so ignore this Use real small capitals <-- ignore this and specify a font size for small caps as most versions of RMSDK (ADE) in use do not work with a font variant to specify small caps Use semantic asterisms and make them reflowable <-- ignore this as background images can work rather poorly with eInk screens Fake asterisms (context change) <-- ignore this because you ignored the one above that goes with it Force the color of links to be text’s <-- ignore this as it's not useful on eInk screens Make HTML5 tags behave as expected in legacy RMSDK <-- ignore this as you don't need a block display Prevent horizontal margins to reflow with font-size <-- ignore this as % for the margins is a very bad idea and the size of the margins will change based on the screen size and possibly resolution Create an automated numbering system <-- ignore this as it won't work in enough cases Build a super simple responsive grid <-- ignore this as it won't work in enough cases Give text wraps a modern twist <-- ignore this as it won't work with ePub 2 Force images to keep their aspect ratio <-- ignore this as it won't work with ePub 2 and I've never seen images be skewed to need to fix the aspect Use text color as a variable <-- forget used colored text as it doesn't work well with eInk screens So after looking at all the tips/tricks, most of them should be ignored. They could end up breaking the eBook depending on the software used to read the eBook. |
|
![]() |
![]() |
![]() |
#13 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,312
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
Jellby is correct - 120% or 1.2em are effectively the same thing. They are both 1.2 times the size of the font selected by the user - or defined in the body tag.
It is fairly common - in web page design - to assign the standard font size in the <body> (eg. body {font-size 100%}) and then use em's to define the relative font-size to that 100%. If the user changes the font size in their browser, then all fonts change with respect to the base font size in a usable manner. eBooks are similar. I leave the 100% in the body for default purposes, some may choose not to, but the user has the ability to overide that setting with their reader/app settings. Here's a much better explanation...make sure you read the "addendum" at the end. https://kyleschaeffer.com/css-font-s...-pt-vs-percent |
![]() |
![]() |
![]() |
#14 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
The "addendum" and the description before have at least one mistake: "px" is not equivalent to one screen dot, and it's not resolution dependent. "px" is an absolute unit equal to 1/96 in, although it can be modulated by screen resolution (to make it match a whole number of physical pixels, not necessarily 1) and by intended viewing distance. If a device makes a 11-px font very difficult to see, the device is faulty.
|
![]() |
![]() |
![]() |
#15 | ||
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,123
Karma: 144284184
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
adjusting picture size in Sigil | rosshalde | Sigil | 5 | 11-10-2014 08:57 AM |
Aura HD Adjusting font color | joanmed | Kobo Reader | 17 | 10-24-2014 12:53 AM |
Problem changing font size using font size key | Waylander | Conversion | 0 | 10-02-2013 03:30 PM |
Adjusting Cover Size | jhempel24 | ePub | 17 | 01-20-2012 05:20 PM |
Help adjusting line size, please. | Stitchawl | Calibre | 4 | 04-05-2009 10:53 PM |