Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 05-19-2026, 12:58 PM   #1
Evil Overlord
Enthusiast
Evil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-books
 
Posts: 45
Karma: 972
Join Date: Jul 2011
Device: Kobo Aura One, Kobo Libra Colour
Question Scalable title text that works for all e-readers

As a small publisher, I'm looking for a way to scale my epub title so that it fits e.g., 80% of the screen, regardless of window size.

vw
I had used vw, and Google suggested clamp (e.g., below), but apparently that doesn't work for all e-readers

Code:
h1 {
    font-size: clamp(1.2rem, 4vw, 2.5rem); 
}
container
I have tried a scaling container (e.g., below), but apparently that also doesn't work for all e-readers, and I got inconsistent results even in Sigil.

Code:
<div class="title-container">
    <h1 class="title-single-line">Title</h1>
</div>

.title-container {
    width: 90%;
    margin: 0 auto; 
    text-align: center;
}

.title-single-line {
    white-space: nowrap;
    font-size: 8vw%;
    display: block;
}
svg container
Google also once suggested an svg container (below), but apparently there are issues. (Also, I know nothing about svg).

Code:
<div style="width: 100%; max-width: 600px; margin: 0 auto;">
  <svg viewBox="0 0 500 60" width="100%" height="100%" xmlns="http://w3.org">
    <text x="50%" y="70%" font-family="sans-serif" font-size="40" font-weight="bold" fill="#333" text-anchor="middle">
      Title
    </text>
  </svg>
</div>

Is there a foolproof, all-ereader method for scaling text to fit a window size? NB: I don't want to make the title an image.
Evil Overlord is offline   Reply With Quote
Old 05-19-2026, 02:51 PM   #2
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 83,495
Karma: 153646249
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Try %. All screens are 100%. Do not use rem or vw as they are not backwards compatible.
JSWolf is offline   Reply With Quote
Old 05-19-2026, 03:38 PM   #3
Evil Overlord
Enthusiast
Evil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-booksEvil Overlord has learned how to read e-books
 
Posts: 45
Karma: 972
Join Date: Jul 2011
Device: Kobo Aura One, Kobo Libra Colour
Quote:
Originally Posted by JSWolf View Post
Try %. All screens are 100%. Do not use rem or vw as they are not backwards compatible.
Thanks. Can you clarify what you mean? I assume [font-size: X%;] would set the title font to a percentage of the default or parent font, whereas what I'm looking for is % of the window size.
Evil Overlord is offline   Reply With Quote
Old 05-19-2026, 03:46 PM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 83,495
Karma: 153646249
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Scaling the font size is a really bad idea. The problem is that if you are using a small screen such as a cell phone, the text could wrap where it would not otherwise.

Why do you want the title page to take up 80% of the screen? Why not just a regular title page?

By suggesting using %, I was thinking of the space between elements.
JSWolf is offline   Reply With Quote
Old 05-19-2026, 07:44 PM   #5
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 51,958
Karma: 180003020
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
I've played with this a couple times. The main issue that I ran into is that many of the prettier techniques are not supported widely across multiple renderers.

The last solution I used which worked for a specific situation involved using a container-type inline-size and the font size set to 6cqw. I've attached a sample ePub using that technique.

Edit: This method works on Sigil's preview and EpubJSReader plugin. The BibiReader and ReadiumReader plugins display the text but the resizing does not work. For calibre, the ebook-viewer and the ebook-editor's preview work happily. One item to remember is both Sigil and calibre are basically using a Chrome web browser to display the text.
Attached Files
File Type: epub test_019.epub (2.4 KB, 5 views)

Last edited by DNSB; 05-19-2026 at 07:51 PM. Reason: Added comment about Sigil and calibre
DNSB is offline   Reply With Quote
Old 05-19-2026, 08:54 PM   #6
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,933
Karma: 9600001
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
All ereaders? Epub2 and epub3 ones? The only way is to employ an image and give the image a widh of 80%. For example:

Code:
<h1 class="first" title="My title"><img class="title" alt="My title" src="../Images/Mytitle.svg"/></h1>
and

Code:
.first {
   text-align: center;
   margin: 1em 0;
}

.title {
   width: 80%;
}
The key in THIS case is not use a svg wrapper but a <img> tag. And the svg must have paths, not text. Watch the epub I attach. It works everywhere.
Attached Files
File Type: epub SVG as Title.epub (6.7 KB, 9 views)

Last edited by RbnJrg; 05-19-2026 at 08:59 PM.
RbnJrg is offline   Reply With Quote
Old 05-19-2026, 09:40 PM   #7
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 51,958
Karma: 180003020
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by RbnJrg View Post
All ereaders? Epub2 and epub3 ones? The only way is to employ an image and give the image a width of 80%. For example:
That would be my first choice but the OP specifically stated they did not want to make the title an image.
DNSB is offline   Reply With Quote
Old 05-19-2026, 09:59 PM   #8
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,933
Karma: 9600001
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by DNSB View Post
That would be my first choice but the OP specifically stated they did not want to make the title an image.
You're right, but since the OP used an SVG wrapper and the solution I posted uses an `<img>` tag with the text converted to a path, it might be a valid option for him. There's no other way to make a title occupy 80% of the viewport width, be immune to changes in text size by the user, and work under both EPUB2 and EPUB3.
RbnJrg is offline   Reply With Quote
Old 05-20-2026, 10:52 PM   #9
icearch
Zealot
icearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it is
 
Posts: 135
Karma: 2000
Join Date: Nov 2025
Device: none
I do not suggest anyone employ anything related to vertical position/scaling ie. vertical centering / % to height etc.

It can't even work properly in Sigil, let alone any random e-readers.

Talking about this, I have a question: if someone use scrolling mode in reader apps, how is height % determined? Is it % to screen height or to the whole file length?

Last edited by icearch; 05-20-2026 at 11:27 PM.
icearch is offline   Reply With Quote
Old 05-21-2026, 08:30 AM   #10
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 83,495
Karma: 153646249
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by icearch View Post
I do not suggest anyone employ anything related to vertical position/scaling ie. vertical centering / % to height etc.

It can't even work properly in Sigil, let alone any random e-readers.

Talking about this, I have a question: if someone use scrolling mode in reader apps, how is height % determined? Is it % to screen height or to the whole file length?
This IMHO is a bug in QT that the calibre viewer uses. % should work.
JSWolf is offline   Reply With Quote
Old 05-21-2026, 12:27 PM   #11
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,933
Karma: 9600001
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by icearch View Post
I do not suggest anyone employ anything related to vertical position/scaling ie. vertical centering / % to height etc.
Why? Vertical centering works fine under epub2 and epub3; the problem are due in how percentages are handled in relation to height, which is very different from how they are handled with respect to width (I have posted something about that). And in EPUB3, vertical centering is a piece of cake, since it's done by giving an element the property "display: flex".

Quote:
It can't even work properly in Sigil, let alone any random e-readers.
Vertical centering works fine in Sigil. And in Sigil you can employ the advantage, as I said, of the property "display: flex".

Click image for larger version

Name:	Sigil1.png
Views:	15
Size:	126.7 KB
ID:	223454

Quote:
Talking about this, I have a question: if someone use scrolling mode in reader apps, how is height % determined? Is it % to screen height or to the whole file length?
That's why vertical centering isn't working for you, because you don't understand how the "%" works in that situation. You first have to set a height for the parent element, the element containing what you want to center vertically. The problem arises because if you want to use "%", you first have to give a height to the body element, and that limits the content of the entire .xhtml file. When vertical centering is for a single page (for example, the title or cover page), there aren't major problems; you can handle it, for example, with:

Code:
html, body {
  height: 100%;
  margin: 0;
}

body {
  background: blue;
  position: relative;
}

.vcenter {
  width: 100%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2em;
  font-weight: bold;
  text-align: center;
}
and

Code:
<body>
  <div class="vcenter">This text is centered</div>
</body>
Click image for larger version

Name:	Sigil3.png
Views:	11
Size:	121.2 KB
ID:	223456

Change the font size (for example, to 5em)to watch how vertical-centering works. OTOH, the problems disappear under epub2 if other units of measurement are used instead of "%" (for example, "px"):

Click image for larger version

Name:	Sigil2.png
Views:	12
Size:	196.3 KB
ID:	223455

In the above examplo I use "px" for font-size but is the same if you use "em". Also I used inline styling to have the xhtml code and the css in the same screen but is better to employ classes

And remember, vertical centering is regarding the height of the containing block.

Last edited by RbnJrg; 05-21-2026 at 12:31 PM.
RbnJrg is offline   Reply With Quote
Old 05-21-2026, 09:11 PM   #12
icearch
Zealot
icearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it isicearch knows what time it is
 
Posts: 135
Karma: 2000
Join Date: Nov 2025
Device: none
I see, thanks for your explaination. I will try them later.
icearch is offline   Reply With Quote
Reply

Tags
epub, scale, title


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scalable maps Berzelius Sigil 9 12-31-2015 09:44 AM
Which font works best in title? Gregg Bell Writers' Corner 17 01-31-2015 01:05 AM
Glo Highlighting text only works for a while RobertJSawyer Kobo Reader 9 02-01-2013 04:53 PM
Touch No good font size for a book (fonts aren't scalable enough) jerrry94087 Barnes & Noble NOOK 6 06-12-2011 11:30 AM
Scalable SWF for Bookworm ninni ePub 1 01-18-2010 11:33 AM


All times are GMT -4. The time now is 08:07 AM.


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