Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 11-02-2023, 01:48 PM   #16
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: 74,015
Karma: 129333114
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
You cannot assume webkit is available. It isn't available for ADE. So any webkit code has to go.

Is there a way ib ePub3 to make it so if an image with the caption has to be pushed to the next screen that the text can move to fill in the previous page?
JSWolf is offline   Reply With Quote
Old 11-02-2023, 02:00 PM   #17
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,544
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by JSWolf View Post
Too many devices and/or programs do not support vw and vh. So it's best to use % which will work in many more cases. It's basically the same thing eccept one works more then the other.
Not exactly. When you use "vh" (or "vw") are you referring to the screen size, and with "%" you are referring to the container size. With "vh" you can do things impossible to get with "%". For example, how you could set the height of a <div> block at 40% of the screen? With "%", you couldn't. But, I must agree with you, that some EPUB2 ereaders, don't support the property. Under epub3, vw and vh work flawlessly.
RbnJrg is online now   Reply With Quote
Advert
Old 11-02-2023, 02:07 PM   #18
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: 74,015
Karma: 129333114
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 RbnJrg View Post
Not exactly. When you use "vh" (or "vw") are you referring to the screen size, and with "%" you are referring to the container size. With "vh" you can do things impossible to get with "%". For example, how you could set the height of a <div> block at 40% of the screen? With "%", you couldn't. But, I must agree with you, that some EPUB2 ereaders, don't support the property. Under epub3, vw and vh work flawlessly.
The container is the size of the screen. So % works perfectly well.
JSWolf is offline   Reply With Quote
Old 11-02-2023, 02:18 PM   #19
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,544
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by JSWolf View Post
You cannot assume webkit is available. It isn't available for ADE. So any webkit code has to go.
You didn't pay attention to what i wrote. Didn't you see that besides "-webkit-column-break-inside: avoid !important;" I also employed "break-inside: avoid !important;" and "display: inline-block !important".
Why I did that? Because I use "-webkit-column-break-inside: avoid !important;" for ereaders based on webkit, and I use "break-inside: avoid !important;" and "display: inline-block !important" for ereaders not based on webkit.

Quote:
Is there a way in ePub3 to make it so if an image with the caption has to be pushed to the next screen that the text can move to fill in the previous page?
Yes, is what I said in my previous post. Watch the images I included there, and how the text moves when the font size is changed to avoid blank spaces. With epub3 the fragmentation is completely avoided. Use something like this:

Code:
  <figure>
    <img src="../Images/Your_image.jpg" alt="" style="width:100%"/>

    <figcaption>Fig.1 - Blah, blah, blah</figcaption>
  </figure>
and

Code:
figure {
  float: left;
  margin: 1em 0;
  padding: 4px;
  -webkit-column-break-inside: avoid !important; /* for webkit ereaders */
  break-inside: avoid !important;  /* for the rest of ereaders */
}

figcaption {
  font-style: italic; /* if you wish */
  padding: 2px; /* set here the measure you wish */
  text-align: center; 
}
RbnJrg is online now   Reply With Quote
Old 11-02-2023, 02:37 PM   #20
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,544
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by JSWolf View Post
The container is the size of the screen. So % works perfectly well.
Yes? I challenge you to post an epub with a div with a height of 40% of the screen size. I don't want your words, I want FACTS (I see that you never had the need to create a block with a certain height otherwise you wouldn't have answered as you answered, and so lightly).

Here you can watch an epub with a div (an empty div) with a HEIGHT of 40% of screen (no matter the screen size of the ereader) based on vh. Make the same, but with "%" and post the epub here. I'm looking forward to seeing the code you wrote; I want to learn how you can achieve the impossible.

EDIT: There is a hack that allows to use % but with that hack, many ereaders won't display correctly the epub. I want an epub that display a div with a height of 40% of the screen height and that can be displayed without issues by ereaders based on ADE.
Attached Files
File Type: epub Custom Height.epub (2.2 KB, 24 views)

Last edited by RbnJrg; 11-02-2023 at 02:55 PM.
RbnJrg is online now   Reply With Quote
Advert
Old 11-04-2023, 03:15 AM   #21
HeartWare
Enthusiast
HeartWare began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Nov 2023
Location: Copenhagen, DK
Device: ReadEra Android, Samsung Galaxy Tab S7+, Android 13
Quote:
Originally Posted by Turtle91 View Post
<div class="image"><img src="…" alt=""/></div>

.image {width=50%; float:left}
img {width:100%; max-width: 1000px *or whatever the width of your image*}
Unfortunately, that doesn't seem to work in either Sigil or Calibre. The image occupies the full width with the text below it.

The relevant code from the xhtml is:

<html>
<head>
<link href="../Styles/Style0001.css" type="text/css" rel="stylesheet"/>
</head>

<body>
<div class="image50L"><img alt="Tropical Beach" src="../Images/Tropical%20Beach.jpg"/>Lorem ipsum ... id est laborum.</div>
</body>
</hrml>

and the stylesheet:

.image50L {width=50%; float:left}
img {width:100%; max-width: 9000px}


I have enclosed my test ePub...
Attached Files
File Type: epub Test.epub (1.75 MB, 18 views)

Last edited by HeartWare; 11-04-2023 at 03:18 AM.
HeartWare is offline   Reply With Quote
Old 11-04-2023, 06:45 AM   #22
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,544
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by HeartWare View Post
Unfortunately, that doesn't seem to work in either Sigil or Calibre. The image occupies the full width with the text below it.

The relevant code from the xhtml is:

<html>
<head>
<link href="../Styles/Style0001.css" type="text/css" rel="stylesheet"/>
</head>

<body>
<div class="image50L"><img alt="Tropical Beach" src="../Images/Tropical%20Beach.jpg"/>Lorem ipsum ... id est laborum.</div>
</body>
</hrml>

and the stylesheet:

.image50L {width=50%; float:left}
img {width:100%; max-width: 9000px}


I have enclosed my test ePub...
The property "float: left" must be for the selector img, not for the style img50L. Use something like this:

Code:
<div class="image50L">
     <img alt="Tropical Beach" src="../Images/Tropical%20Beach.jpg"/>
     <p>Lorem ipsum ... id est laborum....</p>
</div>

.............

.image50L {
    width=100%;
}

.image50L  img {
     float: left;
     width:50%; 
     max-width: 9000px
}

Last edited by RbnJrg; 11-04-2023 at 07:07 AM.
RbnJrg is online now   Reply With Quote
Old 11-04-2023, 07:43 AM   #23
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,097
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Quote:
Originally Posted by RbnJrg View Post
The property "float: left" must be for the selector img, not for the style img50L. Use something like this:

Code:
<div class="image50L">
     <img alt="Tropical Beach" src="../Images/Tropical%20Beach.jpg"/>
     <p>Lorem ipsum ... id est laborum....</p>
</div>

.............

.image50L {
    width=100%;
}

.image50L  img {
     float: left;
     width:50%; 
     max-width: 9000px
}
No. That won’t achieve what he’s asking at all. He is trying to get the following paragraphs to flow around the image. Won’t be able to do that if the div is taking up 100% of the width.

Unfortunately I can’t open the ePub on my phone - but from your relevant text example it should work. There must be something else wrong. I will try and look at it when I get home Monday, unless someone else solves it first.

Edit:
On a completely different note: if you are using images that are 9000 pixels wide I would suggest that is WAY too large for an ePub. The file size alone would make the ePub unwieldy not to mention longer rendering times. The maximum dimension size I use is 2200px (height) for the cover image. Other images usually max out around 1000-1500 for detailed images, or 600-750 for little ones.

I don’t think this is the problem, just a typo when putting the example text. You have </hrml> at the end.

Also, check that the stylesheet is linked properly. I see the link info in the head (missing the required <title>) but it may not be the correct info. In Sigil right-click on your xhtml file in the book browser window on the left and select “link stylesheet” then check the box on the stylesheet. You can also try adding a colored border during troubleshooting to make sure it is actually applying the css.

div.image50l {width:50%; float:left; border: 1px solid red}

Last edited by Turtle91; 11-04-2023 at 08:10 AM.
Turtle91 is offline   Reply With Quote
Old 11-04-2023, 08:29 AM   #24
HeartWare
Enthusiast
HeartWare began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Nov 2023
Location: Copenhagen, DK
Device: ReadEra Android, Samsung Galaxy Tab S7+, Android 13
Quote:
Originally Posted by Turtle91 View Post
On a completely different note: if you are using images that are 9000 pixels wide I would suggest that is WAY too large for an ePub.
I'm not - it's just that the one I'm using is wider than the 1000 you specified in your original sample, so I just set it to some high number that I knew I wouldn't reach.

Quote:
Originally Posted by Turtle91 View Post
Also, check that the stylesheet is linked properly. I see the link info in the head (missing the required <title>) but it may not be the correct info. In Sigil right-click on your xhtml file in the book browser window on the left and select “link stylesheet” then check the box on the stylesheet.
That was the way I included it. I just omitted the <title> in my summary tag as it wasn't relevant for the information I wanted to show (since I included the compiled ePub file).

Quote:
Originally Posted by Turtle91 View Post
You can also try adding a colored border during troubleshooting to make sure it is actually applying the css.
That's a splendid advice. I'll try that out.
HeartWare is offline   Reply With Quote
Old 11-04-2023, 08:38 AM   #25
HeartWare
Enthusiast
HeartWare began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Nov 2023
Location: Copenhagen, DK
Device: ReadEra Android, Samsung Galaxy Tab S7+, Android 13
Quote:
Originally Posted by Turtle91 View Post
You can also try adding a colored border during troubleshooting to make sure it is actually applying the css.

div.image50l {width:50%; float:left; border: 1px solid red}
I did the above (without the "div." prefix) and it drew a red border around the area of both the image and the text.
HeartWare is offline   Reply With Quote
Old 11-04-2023, 08:44 AM   #26
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,097
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
RbnJrg’s post made me question whether I understood your question correctly. I’ve been thinking you want an image to take up half the screen with a caption at the bottom. The following paragraph text flows around the image/caption. If that is true, then what we’ve been talking about works:

Code:
div.image50L {width:50%; float:left}
div.image50L img {width:100%; max-width:1000px}
div.image50L span {display:block; font-size:.6em…. Etc. }

<p>Some paragraph before the image.</p>
<div class="image50L"><img alt="…" src="…"/><span>Some Caption</span></div>
<p>Some paragraph the will flow around and to the right of the image.</p>
If you want your caption to flow around the image then RbnJrg’s example works.

Please clarify your question.
Turtle91 is offline   Reply With Quote
Old 11-04-2023, 08:44 AM   #27
HeartWare
Enthusiast
HeartWare began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Nov 2023
Location: Copenhagen, DK
Device: ReadEra Android, Samsung Galaxy Tab S7+, Android 13
Quote:
Originally Posted by Turtle91 View Post
On a completely different note: if you are using images that are 9000 pixels wide I would suggest that is WAY too large for an ePub. The file size alone would make the ePub unwieldy not to mention longer rendering times. The maximum dimension size I use is 2200px (height) for the cover image. Other images usually max out around 1000-1500 for detailed images, or 600-750 for little ones.
The particular image here is 5824x3264 (i got lazy and just took the full resolution image I use on the web), but in the .ePub it'll be resized down to 1536x861 (I resize all images to a max resolution of 1536x1536 during my translation from my own markup to .ePub format, except the cover image).

Just to make sure that this wasn't an issue (I didn't expect it to be), I replaced the image with the .ePub version and the problem persists.
HeartWare is offline   Reply With Quote
Old 11-04-2023, 08:57 AM   #28
HeartWare
Enthusiast
HeartWare began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Nov 2023
Location: Copenhagen, DK
Device: ReadEra Android, Samsung Galaxy Tab S7+, Android 13
Quote:
Originally Posted by Turtle91 View Post
RbnJrg’s post made me question whether I understood your question correctly. I’ve been thinking you want an image to take up half the screen with a caption at the bottom.
My apologies if I have been unclear. This is what I want to achieve:
Quote:
In .html I have achieved this with:

Quote:
<img src="Tropical Beach.PNG" style="text-align:LEFT;width:20vw;float:left;padding:0 8 0 0">Lorem ipsum dolor ... anim id est laborum.
Hope this clears it up...
HeartWare is offline   Reply With Quote
Old 11-04-2023, 09:08 AM   #29
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,097
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
If the Lorem ipsum text is just normal paragraph text then it should easily work with:

Code:
div.image50L {width:50%; float:left}
div.image50L img {width:100%; max-width:1000px}

<p>Some paragraph before the image.</p>
<div class="image50L"><img alt="…" src="…"/></div>
<p>Some paragraph the will flow around and to the right of the image.</p>
Try that with the colored border and the image should be the only thing with the red border.
Turtle91 is offline   Reply With Quote
Old 11-04-2023, 09:08 AM   #30
HeartWare
Enthusiast
HeartWare began at the beginning.
 
Posts: 27
Karma: 10
Join Date: Nov 2023
Location: Copenhagen, DK
Device: ReadEra Android, Samsung Galaxy Tab S7+, Android 13
Okay, with the combined help of all of you, I managed to get it to work:

.css file:

.image50L {width=100%}
.image50L img {width:50%; max-width: 9000px; text-align:left; float:left; padding: 0px 8px 0px 0px}

.xhtml file:

<div class="image50L"><img alt="Tropical Beach" src="../Images/Tropical%20Beach.jpg"/>Lorem ipsum dolor sit amet, consectetur ... id est laborum.</div>

I can certainly make a bunch of classes and other stuff in the .css file, but do I need to specify both lines for all combinations of alignment and percentage size? Ie. I need a several combinations of L and R alignment (not at the same time, obviously :-) ) and varying percentages.
HeartWare is offline   Reply With Quote
Reply

Tags
alignment, img, width


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Image Alignment Issues AndrewCanada Editor 2 10-06-2019 11:47 AM
Text - Image alignment problem MrB Sigil 10 11-03-2012 03:36 AM
Hello/Image and text alignment Derek R Introduce Yourself 3 06-26-2011 10:47 AM
Image alignment and spacing Derek R Kindle Formats 5 06-25-2011 12:57 PM


All times are GMT -4. The time now is 05:12 PM.


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