|
|
#1 |
|
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
Align 2 images
Hi all
How do I align 2 images, so they display in the center of the page, next to each other, with a little white space in between and a bit of explanatory text under each (like, 'this is an image of...')? Many thanks! |
|
|
|
|
|
#2 | |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,881
Karma: 8821117
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
There are others methods but with a table you'll have the two images aligned practically in any ereader. Use the following code:1. In your .xhtml file: Code:
<div class="images">
<table cellpadding="5" cellspacing="0" class="images">
<tr>
<td style="width: 50%"><img alt="Image" src="../Images/leopard.jpg" />This is a leopard</td>
<td style="width: 50%"><img alt="Image" src="../Images/leopard.jpg" />This one too!</td>
</tr>
</table>
</div>
![]() 2. In your .css stylesheet: Code:
div.images {
width: 80%;
margin-bottom: 1.5em;
margin-left: 10%;
page-break-after: avoid;
}
table.images {
padding-top: 1em;
margin: 0 !important;
text-align: center;
text-indent: 0 !important;
font-weight: bold;
font-size: 0.8em; /* Change this if you want */
font-family: serif;
}
table.images tr td img {
width: 100%;
height: auto;
margin: 0;
padding: 0;
vertical-align: middle;
}
I also attach an epub file so you can understand better the things. Regards EDIT: You can style the table inside the .css stylesheet but don't erase cellpadding="5" cellspacing="0" (you can change the values, no problem with that) inside the table tag because otherwise the table won't show centered in ADE. Last edited by RbnJrg; 11-15-2015 at 02:18 PM. |
|
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
Thank you very much, RbnJrg!
|
|
|
|
|
|
#4 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,881
Karma: 8821117
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
|
|
|
|
|
|
#5 |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,327
Karma: 62025226
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Remember to think 'Box Model". It is always thereMargin: places the box Border: defaults to 0 and is invisible Padding: spaces things away from the border, default 0 Content: Images or text each is controllable put padding around the images color the background of the outer box (fill)\ 'Boxing' can be fun |
|
|
|
| Advert | |
|
|
|
|
#6 |
|
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
This 'boxing', should it be done in the 'table.images tr td img' ?
|
|
|
|
|
|
#7 | |
|
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,327
Karma: 62025226
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
Quote:
Tables are a way of stacking boxes (on shelves) with more precision Tables, like boxes can also have their borders show. It take a bit to wrap your head around boxes and their cascaded results. I only scrape the basics of CSS. Thankfully, EPUB only supports the basics
|
|
|
|
|
|
|
#8 |
|
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
I only scrape the * whatever 's lower than basics*
|
|
|
|
|
|
#9 |
|
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,560
Karma: 93980341
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
Tables are easy. Just need something like:
<table> <tr> <td>This is the first cell</td> <td>This is the second cell</td> </tr> </table> Just replace the text with images. |
|
|
|
|
|
#10 |
|
Village idiot
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 157
Karma: 519566
Join Date: Mar 2014
Location: Belgium
Device: sony PRS T-1
|
yeah, that far I scrape, but this:
Code:
table.images {
padding-top: 1em;
margin: 0 !important;
text-align: center;
text-indent: 0 !important;
font-weight: bold;
font-size: 0.8em; /* Change this if you want */
font-family: serif;
}
table.images tr td img {
width: 100%;
height: auto;
margin: 0;
padding: 0;
vertical-align: middle;
}
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Attribute 'align' | daveconifer | Sigil | 4 | 09-05-2014 11:13 AM |
| How to align/stretch images in the ebook | knowledgecrawler | Recipes | 1 | 08-24-2014 02:04 PM |
| Images linked, 'Align' and 'Width' attributes | sebdea | Kindle Formats | 2 | 01-17-2012 09:16 AM |
| need help on how to align a table to the right | NASCARaddicted | ePub | 6 | 02-18-2011 02:46 PM |
| I can not align the text...help please! XD | derfel_spain | ePub | 17 | 12-18-2010 10:45 AM |