![]() |
#1 |
Connoisseur
![]() Posts: 75
Karma: 10
Join Date: Apr 2011
Location: UK
Device: none
|
float not working as expected in ADE
Hi all
We have some text + a pic in coloured box that appears at the end of various articles within our ePub. It looks good in iBooks (see screenshot attached) but breaks down in ADE. The code is as follows; <div class="story rightFloat"> <p class="biography-in-blue-box"><span class="bio-blue-box-pic"><img alt="nicovaneijk.jpg" class="rightFloat" height="139" src="../Images/nicovaneijk_fmt.jpeg" width="98" /></span>Nico van Eijk is Professor of meh.</p> </div> and the CSS is; Code:
p.biography-in-blue-box{ background: #662282 !important; color: white; font-weight: bold; padding:0.5em; margin-right:30%; line-height:1.25em; -webkit-hyphens:none; } span.bio-blue-box-pic{ width:100%; float:right } thanks, Iain |
![]() |
![]() |
![]() |
#2 | |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
The thing is you are using "width: 100%" for the span, so it takes the whole width of the paragraph, leaving no room for text. iBooks places no text there and skips until below the picture, while it seems ADE is placing always a word at least on each line. I'd use something like: Code:
span.bio-blue-box-pic{ display: block; text-align: left; } |
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Connoisseur
![]() Posts: 75
Karma: 10
Join Date: Apr 2011
Location: UK
Device: none
|
Thanks Jellby - I changed the span definition with my existing code and it is now working. And I can understand how it works. Brilliant - thanks!
|
![]() |
![]() |
![]() |
#4 |
Connoisseur
![]() Posts: 75
Karma: 10
Join Date: Apr 2011
Location: UK
Device: none
|
A supplementary question if I may - I want that purple box not to get split over two pages. If I add display: inline-block; to the CSS for the containing paragraph (biography-in-blue-box), in ADE it doesn't split but the right margin disappears and the purple box fills the width of the whole page. If I preview it in a webkit-based reader (Ibis) the box's right margin is still honoured. Any way I can stop if filling the whole width in ADE (and webkit)?
|
![]() |
![]() |
![]() |
#5 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
inline-block is not supported in the ePUB standard, so it's better not to use it. If you want to avoid page breaks inside an element, use "page-break-inside: avoid" (I'm not 100% sure that works in ADE, but it should)
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Connoisseur
![]() Posts: 75
Karma: 10
Join Date: Apr 2011
Location: UK
Device: none
|
Thanks Jellby. I'm pretty sure page-break-inside: avoid isn't supported in webkit but testing it out in ADE it works, but if I then apply the span to the image using the code you suggested earlier then it splits the paragraph after the pic (see attached). The text still clears the pic (here and on other pages) but it seems to be overruling the page-break-inside: avoid.
|
![]() |
![]() |
![]() |
#7 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
I think I have had success by adding "page-break-after: avoid" (or -before) to the elements inside, try something like:
Code:
span.bio-blue-box-pic{ page-break-after: avoid; } |
![]() |
![]() |
![]() |
#8 |
Connoisseur
![]() Posts: 75
Karma: 10
Join Date: Apr 2011
Location: UK
Device: none
|
Thank you - that combination of code works great now
|
![]() |
![]() |
![]() |
#9 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error expected td or th | jmickey | Conversion | 11 | 04-07-2011 04:14 PM |
How to "float" illustrations correctly? | lindsayw | Workshop | 5 | 03-29-2011 08:09 AM |
ADE suddenly stopped working? | suecsi | Reading and Management | 5 | 11-03-2010 01:53 PM |
ADE suddenly stopped working? | suecsi | 2 | 10-26-2010 02:45 PM | |
No. of visitors expected | Manishsb | General Discussions | 5 | 08-05-2010 11:20 AM |