![]() |
#1 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 656
Karma: 567890
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
join (image + caption) and fill page
I'm converting a book with photographic features.
I'd like to present each photo so it + its caption just fills a page. They're at different ratios, some landscape, some portrait. And I'd like it to work whether the reader is in either orientation too. What I've done is this CSS: Code:
img.wide { width:100%; margin-top:1em; margin-bottom:1em; } img.tall { height:80%; align:center; margin-bottom:1em; } .caption { text-align:center; font-style:italic; margin-bottom: 1em; text-indent: 0; } Code:
<div class="center"> <img alt="" class="tall" src="../Images/tall.jpg" /> <p class="caption">Tall image caption</p> </div> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> <div class="center"> <img alt="" class="wide" src="../Images/wide.jpg" /> <p class="caption">Wide image caption</p> </div> This works most of the time, but if I resize a reading app the caption can be separated from the photo. What can I do to weld the photo + caption so they are never separated, and just resized to fit whatever the screen is? And these should work in the text stream, so for instance a "wide" photo can fill half a page, and the article text is above and below it. Would even consider the black art of svg if it can do it. Last edited by AlanHK; 04-03-2015 at 11:16 PM. |
![]() |
![]() |
![]() |
#2 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 69,733
Karma: 116730707
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
You cannot rotate the images based on the orientation of the device. There is no way to tell what the orientation is. So the best way to do your book is to set it up as best you can for portrait.
Now given that devices like the Kobo Aura HD, Kobo Aura H2O, Kindle Voyage, Microsoft Surface tablets, and other devices, you do want to use high resolution images. 1440 lines would do well enough if you can go that high. Yes, I know this is going to make your eBook huge, but in order to look it's best, you have to not skimp on image quality. Last edited by JSWolf; 04-03-2015 at 11:14 PM. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | ||
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 656
Karma: 567890
Join Date: Apr 2014
Device: PW-3, iPad, Android phone
|
Quote:
I don't know why you think I did. I want to make the picture as large as will fit without pushing the caption off the screen. For just an image, I use the same code that Sigil creates when it makes a cover. That resizes no matter what size or orientation the screen is. Quote:
So I can't ignore how it looks in landscape mode. Last edited by AlanHK; 04-04-2015 at 03:43 AM. |
||
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,450
Karma: 5738999
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Use the following code:
1. In your .css stylesheet: Code:
p { text-align: justify; text-indent: 1em; font-size: 1em; margin-bottom: 1em; } Code:
<body> <div> <svg xmlns="http://www.w3.org/2000/svg" height="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 248 360" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"> <image height="310" width="248" xlink:href="../Images/Obama.jpg"/> <text text-anchor="middle" x="124" y="330"> Barak Obama <tspan x="124" y="350">President of the United States of America</tspan> </text> </svg> </div> </body> Below you can check the respective .epub. Regards Rubén Last edited by RbnJrg; 04-04-2015 at 04:24 PM. |
![]() |
![]() |
![]() |
#5 | |
Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
|
Quote:
So if you wanted to, you could specify two different SVG images with different cropping. Then have SVG "a" defined as display: block, and SVG "b" defined as display: none, and add a media query afterwards for "(orientation: landscape)" that swaps the display values. That way, dumb readers that don't support media queries would default to the portrait orientation (which is correct more often than not), and newer readers should do the right thing based on orientation. |
|
![]() |
![]() |
Advert | |
|
![]() |
Thread Tools | Search this Thread |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
keeping image and caption together | whbenson | ePub | 0 | 08-20-2013 06:19 PM |
How to be sure a full page image+ caption is not split between 2 pages? | silviolorusso | ePub | 9 | 07-12-2013 08:24 PM |
Caption, distance from image | GraciousMe | Sigil | 10 | 10-30-2012 11:12 AM |
L shape image with caption? | LostSock | ePub | 5 | 09-08-2011 07:24 PM |
Center Image and Caption | SamL | ePub | 11 | 08-12-2011 09:27 AM |