Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 05-06-2019, 04:05 AM   #1
odedta
Addict
odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.
 
Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
How to create this element cross-compatible

Hello

I want to create the element attached (Screenshot_2.jpg). AFAIK there are no :before or :after pseudo-selectors in ePub3 so I would have to use an <img> instead of content: "" and absolute positioning is not well supported.

Here is the HTML:
Code:
<div class="align-center">

    <img class="bird" src="../images/bird.png" alt="bird" style="left: 41%;"/>

    <h1 class="heading-bird" id="toc_1">Preface</h1>

  </div>
Here is the CSS:
Code:
.bird {
  display: block;
  position: relative;
  left: 38%;
  top: 9px;
  margin-left: -3px;
  width: 40px;
}
h1.heading-bird {
  position: relative;
  display: inline-block;
  margin: 0 auto;
  background-color: #4D4D4F;
  color: white;
  padding: 10px;
  border-radius: 25px;
  margin-top: 0px;
  margin-bottom: 40px;
}
It looks good on iPad and Android, however, when I upload to KDP, the bird looks like a small dot. (Screenshot_3.jpg).

Any idea how to get this to work?

*I have uploaded the bird image as well for testing purposes

Thanks!
Attached Images
   
odedta is offline   Reply With Quote
Old 05-06-2019, 08:32 AM   #2
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,760
Karma: 5706256
Join Date: Nov 2009
Device: many
Perhaps the dot is simply the leftmost bit of tail feather? So the bird is positioned properly but covered by the Preface background. Try making the background of the Preface transparent and not white.

Alternatively fire up the Gimp or any other image editors and create one new merged image.
KevinH is online now   Reply With Quote
Advert
Old 05-06-2019, 10:13 AM   #3
odedta
Addict
odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.
 
Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
Hey Kevin,

The background of the word Preface is not white, it's the same color as the bird. In addition, that background size is determined by the element's property so I don't see why the bird is covered up assuming that dot is the trail.
I prefer to use an HTML/CSS solution if possible.

Thank you!
odedta is offline   Reply With Quote
Old 05-06-2019, 11:08 AM   #4
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,760
Karma: 5706256
Join Date: Nov 2009
Device: many
If the dot is the entire bird image scaled down, have you tried providing a specific height property for the bird image. Does that impact anything for KDP?
KevinH is online now   Reply With Quote
Old 05-06-2019, 12:30 PM   #5
odedta
Addict
odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.
 
Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
It didn't :/

Last edited by odedta; 05-06-2019 at 12:49 PM.
odedta is offline   Reply With Quote
Advert
Old 05-06-2019, 12:55 PM   #6
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,760
Karma: 5706256
Join Date: Nov 2009
Device: many
I set this up in Sigil and had to add a "align-center" class to the stylesheet and ran the new WebEngine Inspector on the image and it did not like the css .bird left percentage as it was overridden in the xhtml img tag style attribute which takes precedence. It was not an error just overridden.

I had to tweak the 38% down to 35% to make the bird just touch the heading but other than that it seems to work well on WebKit/WebEngine based viewers such as Sigil and calibre.

I can see no reason why this would not work in a Mobi 8 (.azw3). Would an svg solution be possible/acceptable? Is the KDP for old mobi or newer?

Last edited by KevinH; 05-06-2019 at 01:01 PM.
KevinH is online now   Reply With Quote
Old 05-06-2019, 01:02 PM   #7
odedta
Addict
odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.odedta read the news today, oh boy.
 
Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
Thanks for trying to help Kevin, I actually decided to remove all the inline styling and place the bird in the center, the new CSS I use is this:
Quote:
.bird {
display: block;
position: relative;
margin: 10px auto -8px auto;
width: 40px;
height: 42px;
}
It does look good in Calibre, iPad and Android which is weird that it doesn't look good on the KDP Previewer. I don't have an SVG, only the PNG, I could convert though, I will try that and let you know.

Thanks again!
odedta is offline   Reply With Quote
Old 05-06-2019, 01:14 PM   #8
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,760
Karma: 5706256
Join Date: Nov 2009
Device: many
I ran my testing.epub of your original query through KindlePreviewer3.0 latest available from Amazon, and it seemed to ignore the left on the .bird image and put in in the centre but other than that, all worked.

Not sure why KDP is giving you such an issue when KindlePreviewer seems to be happy with it.

Sorry I can't be more help.
KevinH is online now   Reply With Quote
Old 05-06-2019, 02:51 PM   #9
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 7,070
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
I put the code from the first post into an EPUB and ran it though kindlegen. It produced this warning:

Warning(htmlprocessor):W28003: Value specified for CSS property in content is not supported by Kindle readers. Please refer Kindle Publishing Guidelines about usage of property: 'position: relative' in file: ...
jhowell is offline   Reply With Quote
Old 05-06-2019, 05:20 PM   #10
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,763
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
The following code seems to work fine with epub3:

Code:
  <h2 class="bird"><img class="birdy" alt="bird" src="../Images/bird.png"/>Preface</h2>

  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac tellus nunc. Phasellus imperdiet leo metus, et gravida lacus. Donec metus ligula, elementum at pellentesque pellentesque, suscipit ac nunc. Etiam lobortis, massa ac aliquam auctor, augue nisl sagittis urna, at dapibus tellus erat ullamcorper ligula. Praesent orci dui, pulvinar id convallis a, faucibus non mauris. Donec tellus augue, tempus sed facilisis sed, fringilla quis leo. Mauris vulputate, leo ac facilisis vulputate, enim orci interdum augue, in blandit quam turpis quis dui. Morbi dictum luctus velit nec faucibus. Cras vitae tortor purus, ut tincidunt mauris. Sed at velit nisl. Donec eu mauris tortor, interdum condimentum erat. Nam egestas turpis eget nibh laoreet pharetra. Suspendisse a sem eros, ut pulvinar enim. In sed elit eu nulla accumsan tincidunt eget sit amet ipsum. Nullam ut massa rutrum dolor placerat tempor accumsan eget purus.</p>
and:

Code:
p {
     text-align: justify;
}

.bird {
     width: 40%;
     margin: 2em auto;
     padding: 20px;
     background: #4D4D4F;
     color: white;
     border-radius: 70px;
     text-align: left;
     text-indent: 0;
     font-style: italic;
     font-weight: bold;
     font-family: serif;
     font-size: 50px;
}

.birdy {
     float: left;
     height: 74px;
     width: 71px;
     margin-top: -73px;
     margin-left: -25px;
}
Click image for larger version

Name:	Image1.png
Views:	284
Size:	65.5 KB
ID:	171338

Below you can check the respective epub.

Regards
Rubén
Attached Files
File Type: epub Bird.epub (4.3 KB, 139 views)
RbnJrg is online now   Reply With Quote
Old 05-06-2019, 05:31 PM   #11
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,763
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by odedta View Post

It looks good on iPad and Android, however, when I upload to KDP, the bird looks like a small dot. (Screenshot_3.jpg).

Any idea how to get this to work?
You need to set a "width" and "height" for the bird, specially if you are going to use a pseudo-element (in this case, ::before). Kindle (.kf8/.KFX formats, is ok Hitch? ) supports pseudo-element, so you can use it (if you wish).

In that case, you'll need to use something like:

Code:
.bird::before {
     display: block;
     content: url("../Images/bird.png");
     position: relative;
     width: your_width_here; 
     height: your_height_here;
     top: ?;  /* try to locate the best top */
     left: ?; /* idem above */
}
Regards
Rubén
RbnJrg is online now   Reply With Quote
Old 05-06-2019, 06:15 PM   #12
lumpynose
Wizard
lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.
 
Posts: 1,086
Karma: 6719822
Join Date: Jul 2012
Device: Palm Pilot M105
For the svg, maybe you can use this, the "or even more advanced":

https://www.mobileread.com/forums/sh...40&postcount=2
lumpynose is offline   Reply With Quote
Old 05-06-2019, 06:57 PM   #13
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,763
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by lumpynose View Post
For the svg, maybe you can use this, the "or even more advanced":
With that aproximation, the picture will full the page and the OP wants it as a heading. That is not a solution for the present case; you can use .svg but not as svg wrapper but as a svg image. But, why to use a .svg image if under epub3 is possible to get that effect by pure css2/css3 (besides my aproximation above, that uses "float", you would be able to use a pseudo-element ::before, or also a "grid")? In this post:

https://www.mobileread.com/forums/sh...21&postcount=3

you can watch similar effects.
RbnJrg is online now   Reply With Quote
Old 05-06-2019, 07:35 PM   #14
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,569
Karma: 204127028
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Keep in mind that the OP was asking for a cross-platform (one-size fits all) solution. Not two different solutions.
DiapDealer is offline   Reply With Quote
Old 05-06-2019, 10:12 PM   #15
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,763
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by DiapDealer View Post
Keep in mind that the OP was asking for a cross-platform (one-size fits all) solution. Not two different solutions.
Right! But also the OP speaks about epub3 (in epub2 we can't get boxes with round corners). Round corners under epub2 only by means of images. Are we under epub3? If so, then above there is a solution (for ADE). The OP can use media queries to write minor changes to adapt the code to Kindle (.kf8/.KFX).

Last edited by RbnJrg; 05-06-2019 at 10:16 PM.
RbnJrg is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Element <y> not permitted anywhere... Telyt Editor 4 02-03-2015 07:36 PM
Why Not Pantech Element? robertc88 Android Devices 1 02-26-2013 10:25 AM
unfinished element? Oldpilot Sigil 6 11-02-2010 08:32 PM


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


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