09-15-2024, 12:02 PM | #16 | |
Wizard
Posts: 1,606
Karma: 8291219
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
If you want to center (text or images) by using the property "position: fixed", you need to use the following code: 1) In your xhtml file: Code:
<p class="fixedTop">Hello!!</p> <div class="fixedBottom"> <img class="myImg" alt="epub" src="../Images/epub.png"/> </div> Code:
body { margin: 0; } .fixedTop { position: fixed; top: 0; width: 100%; /* This is key */ /* The following properties are for centering (text or images) */ margin: 0; text-indent: 0; text-align: center; } .fixedBottom { position: fixed; bottom: 0; width: 100%; /* This is key */ /* The following properties are for centering (text or images) */ margin: 0; text-indent: 0; text-align: center; } .myImg { width: 20%; /* Or the width you wish */ } However, not all epub2 ereaders will honor the property "position: fixed". So, if you plan to make your epub only for epub2, then you should use a table; on the other hand, if you plan to make your epub for epub3, then you should use the property "display: flex" to do what you want to get. Regards |
|
09-15-2024, 12:16 PM | #17 |
A Hairy Wizard
Posts: 3,215
Karma: 19000635
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
|
OK - last iteration, I promise! (I use this as an excuse for getting out of chores - all y'all NEED my advice )
Using Sigil I was able to push the vh back to 100 by surrounding the author name with the div delineator. This works no-matter the height of the display window. Make sure you only use this technique on its own html page...otherwise the div's will superimpose over your other text. Code:
CSS: body, p {text-align:center; font-family:serif; font-weight:bold; text-indent:0; padding:0; margin:0} h2.title {font-size:2.7em; text-transform:uppercase} .auth {font-size:1.4em; font-variant:small-caps} .sub {font-size:1.1em} .pub {font-size:.8em} .pub img {display:block; width:10%; margin:0 auto} div[class^="v-"] {height:100vh; width:100vw; display:table; position:fixed} div.v-top div {display:table-cell; vertical-align:top} div.v-mid div {display:table-cell; vertical-align:middle} div.v-btm div {display:table-cell; vertical-align:bottom} Code:
HTML:
<body>
<div class="v-top">
<div>
<p class="auth">Thomas Perry</p>
</div>
</div>
<div class="v-mid">
<div>
<h2 class="title">Eddie's Boy</h2>
<p class="sub">A Novel</p>
</div>
</div>
<div class="v-btm">
<div>
<p class="pub"><img alt="" src="../Images/logo_MysteriousPress.png"/>
The Mysterious Press<br/>New York</p>
</div>
</div>
</body>
>=======< You can also put the title/sub lines in the 'top' group: Code:
HTML:
<body>
<div class="v-top">
<div>
<p class="auth">Thomas Perry</p>
<h2 class="title">Eddie's Boy</h2>
<p class="sub">A Novel</p>
</div>
</div>
<div class="v-btm">
<div>
<p class="pub"><img alt="" src="../Images/logo_MysteriousPress.png"/>
The Mysterious Press<br/>New York</p>
</div>
</div>
</body>
|
09-15-2024, 12:16 PM | #18 | |
Wizard
Posts: 1,606
Karma: 8291219
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Code:
html, body {height: 100%} And to avoid your issues with margins (and also paddings and borders) you could use the property "box-sizing: border-box"; but again the property won't be honored by many epub2 ereaders. Today, epub2 is more a problem than a solution To me it's totally deprecated (but I still have to use epub2 properties and code ) |
|
09-15-2024, 12:46 PM | #19 | ||
A Hairy Wizard
Posts: 3,215
Karma: 19000635
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
|
Quote:
Quote:
As always, it depends on the capabilities of your device. Good point on the html, body {height:100%}! You can also use fall-back coding for those nasty older devices that don't support 90's technology... Code:
div[class^="v-"] {height:100%; width:100%; height:100vh; width:100vw; display:table; position:fixed} Code:
div[class^="v-"] {height:100%; width:100%; height:100vh; width:100vw; display:table; position:fixed} Last edited by Turtle91; 09-15-2024 at 12:49 PM. |
||
09-17-2024, 09:43 AM | #20 | |
Resident Curmudgeon
Posts: 76,140
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
09-17-2024, 03:33 PM | #21 | |
A Hairy Wizard
Posts: 3,215
Karma: 19000635
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
|
Quote:
Jon...the key words are: "you have to make sure the CSS is considered valid" Do that using fall-back coding....so if it doesn't understand or support a particular css then it will fall back to coding that it does support....that's all part of good/valid coding... I will put this example up one more time. Please do some research/learning on how css works. (check out 'CSS order of precedence', and 'specificity') While you are at it, check up on @media and @supports. {color:blue; color:red; color:green} will show the color as green because it is the last (most recent) item on the list (not counting styling in the header of the html page, or inline styling) {height:50%; height:75vh} will use a height of 75% of the viewable height IF THE DEVICE SUPPORTS VH. If it doesn't support VH then it gracefully ignores it (as required by spec) and falls back to the next most recent item on the list and will use a height of 50%. Thus you CAN have css that uses the advanced ePub3.3 and/or html5 for the devices that support it, while still being readable on an ePub2 device. You absolutely do NOT have to code for ePub2 only just to be compatible. |
|
09-20-2024, 01:50 PM | #22 | |
Resident Curmudgeon
Posts: 76,140
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
The other thing is, if the older ePub 2 type code does work such as % instead of vh, then there's no reason to use vh. The other thing I'm not sure of is doesn't duplicate code lower down in the CSS get used instead of code higher up? If that is the case, then the % would be ignored for the vh and the code would not work in the older RMSDK. But what do you do with ePub 3.x CSS that the older RMSDK thinks is an error and ignores the entire CSS? That would mean the code you are using is going to be an issue. Last edited by JSWolf; 09-20-2024 at 01:54 PM. |
|
09-20-2024, 02:19 PM | #23 | ||||
A Hairy Wizard
Posts: 3,215
Karma: 19000635
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
|
Quote:
For the small(ish) percentage of people that publish specifically on the kobo, they should be aware of their broken product and bring it up with the manufacturer. If the manufacturer is unresponsive, and they continue using a broken product, then that is on them. Quote:
Quote:
Quote:
At some point you need to stop using the horse and buggy... |
||||
09-20-2024, 02:39 PM | #24 |
Resident Curmudgeon
Posts: 76,140
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
I highly doubt that Kobo will update RSMDK. They haven't updated RMSDK since I've had a Kobo. The thing is, you cannot guarantee that an eBook will be read as KePub on a Kobo.
There is no upgrading RMSDK on a Kobo. I cannot see Kobo updating to the latest RMSDK. |
09-20-2024, 03:08 PM | #25 | |
A Hairy Wizard
Posts: 3,215
Karma: 19000635
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
|
Quote:
My point still stands: if the manufacturer refuses to update their non-spec-compliant device, and you choose to continue using it, that’s on you. Your choice, of course, but choices have consequences. On the other hand, if people stop using broken devices, they will either get fixed, replaced, or go out of business. |
|
09-21-2024, 01:02 AM | #26 | |
Wizard
Posts: 1,606
Karma: 8291219
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
All css3 properties are in one css stylesheet and all css2 properties are in another css stylesheet. With javascript I add the stylesheet with the css3 properties to the xhtml files. If the epub is open with an epub2 ereader, then the script is not executed and the css3 properties never are employed (because never is linked to the xhtml files). On the other hand, if the epub is open by an epub3 ereader, the script is executed, the css3 stylesheed is added and the css3 properties overwrite the css2 ones. One of this days I will upload an epub2/3 so you can watch how the code works. The epub3 ereaders will give the best reading experience while epub2 ereaders can give a decent (but not the best) one. |
|
09-21-2024, 05:27 AM | #27 | |
Resident Curmudgeon
Posts: 76,140
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
|
|
09-21-2024, 08:13 AM | #28 |
Wizard
Posts: 1,606
Karma: 8291219
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
|
09-23-2024, 08:58 AM | #29 |
Resident Curmudgeon
Posts: 76,140
Karma: 134368292
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
09-23-2024, 11:46 PM | #30 |
Wizard
Posts: 1,606
Karma: 8291219
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Screen shady bottom | emreceng | Onyx Boox | 3 | 02-09-2020 01:15 PM |
Aura HD Lines on bottom of screen | hf.tan | Kobo Reader | 4 | 08-28-2014 08:02 PM |
Page numbers at bottom of screen | Waylander | Sony Reader | 1 | 10-18-2013 02:21 PM |
Circled M or S at the bottom of the screen | Larken | Sony Reader | 4 | 12-18-2009 03:15 PM |
Black line 3½ cm from bottom of screen | Moonraker | iRex | 6 | 08-20-2006 11:19 AM |