![]() |
#1 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,759
Karma: 5706256
Join Date: Nov 2009
Device: many
|
Help with epub3 image alignment?
Hi All,
I am trying to create an epub3 of my father-in-law's memoirs, and I have been stumped trying to get the first figure to align to the centre of the page and keep the figcaption left aligned. My xhtml code passes EpubCheck and my complete stylesheet passes the W3C check. Here is a xhtml code snippet at the top of the page. This snippet comes right after the heading tag "Photo Gallery" at the start of the body tag. Code:
<figure class="tall"> <img alt="Olga and Johann Wiedmann Wedding Bride and Groom" src="../Images/olga_johann_wedding.jpg"/> <figcaption><strong>Olga Lock and Johann Wiedmann Wedding</strong> – My parents on<strong> </strong>their wedding day in 1928.</figcaption> </figure> Code:
figure { page-break-after:always; text-align: center; } figure.tall { width: 65%; } figure.wide { width: 95%; } figure img { width: 100%; } figcaption { text-align: left; } Given that this is epub3, I am trying to use the figure and figcaption tags instead of a div with the img and a p tag for the caption. What I am doing wrong? Do I have to drop figure and figcaption use and go back to div, img and p tags? Nothing I have tried with css will align the "tall" image to the center of the page without aligning the figcaption as well. Any hints appreciated? KevinH |
![]() |
![]() |
![]() |
#2 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,548
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Code:
figure { page-break-after:always; text-align: center; } (a) put the the <figure> inside another container, say a <div>, that is width:100% and text-align:center; or (b) give side margins to the <figure> such that it appears centered, like margin:0 auto, or margin:0 17.5% (for figure.tall) |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,759
Karma: 5706256
Join Date: Nov 2009
Device: many
|
Ah! Thank you! As you can see I am a better C++ programmer than an epub producer!
I will make those changes. Edit: Interestingly, wrapping each figure in a div with class "figimg" and using this style Code:
div.figimg { width: 100%; text-align: center; } But your option b: using margin: 0 auto; on each tall figure worked liked a charm! Thank you! Last edited by KevinH; 03-11-2021 at 11:43 AM. |
![]() |
![]() |
![]() |
|
![]() |
||||
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 |