03-21-2012, 04:23 PM | #1 |
Rookie Know-It-All
Posts: 7
Karma: 10
Join Date: Mar 2012
Location: South Florida
Device: I use them all!
|
Media Queries on Kindle Previewer
Rookie HTML/CSS user here...
Does the Kindle Previewer support Media Queries? I have 2 seperate style sheets in my epub targeting: >No Media Queries >amzn-mobi ...in that order! Kindle previewer is not using the mobi.css style sheet when Kindle device is selected. It continues to use the CSS with no media queries. Here is a snippet of my code in Sigil. I've found limited material on media queries for eBooks. Is there a link to a good resource that someone can throw at me? I'd appreciate it. Basically, I'm currious how you pro's are using Queries? Are you making one epub that all eBooks are made from? For example, The epub file you make contains the style sheets for Kindle and Nook (Nook ignores media querie style sheets at the moment) or do you have an epub with out media queries for Nook, etc. and another for Kindle conversion with media queries in all CSS's? |
04-10-2012, 10:00 AM | #2 |
Zealot
Posts: 127
Karma: 12096
Join Date: May 2010
Device: Loads!
|
I find that this:
@media amzn-mobi{ ... insert your styles here... } Works if you put it in your main stylesheet. |
Advert | |
|
04-10-2012, 10:17 AM | #3 | |
Grand Sorcerer
Posts: 28,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
I use one main css file to import the proper specific css file(s) based on media queries, myself. It offers me a lot of flexibility that way. The main.css file: Code:
@import url(../Styles/epub.css); @import url(../Styles/mobi.css) amzn-mobi; @import url(../Styles/kf8.css) amzn-kf8; Code:
<link href="../Styles/main.css" rel="stylesheet" type="text/css" /> Last edited by DiapDealer; 04-10-2012 at 10:27 AM. |
|
04-10-2012, 10:22 AM | #4 |
Zealot
Posts: 127
Karma: 12096
Join Date: May 2010
Device: Loads!
|
|
04-10-2012, 10:32 AM | #5 |
Grand Sorcerer
Posts: 28,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
But it does work (as long as the css you used can be properly converted to the mobi format). That style will only be view-able in the mobi-only portion of the resulting mobi. You'd have to switch the Previewer to 'Kindle' emulation to see the results, though. The 'Fire' emulation mode (default) won't use the parts identified with the 'amzn-mobi' media query.
|
Advert | |
|
04-10-2012, 10:38 AM | #6 |
Zealot
Posts: 127
Karma: 12096
Join Date: May 2010
Device: Loads!
|
I'm finding that the first style in the block is being ignored!
|
04-10-2012, 10:50 AM | #7 |
Grand Sorcerer
Posts: 28,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
It was working properly before the recent 2.4 Previewer upgrade. That I'm sure of. Perhaps they broke something? I'd have to do some testing.
|
04-10-2012, 10:52 AM | #8 |
Zealot
Posts: 127
Karma: 12096
Join Date: May 2010
Device: Loads!
|
Using MobiGen 6.2 command line, and Previewer 2.31
|
04-10-2012, 11:11 AM | #9 |
Zealot
Posts: 127
Karma: 12096
Join Date: May 2010
Device: Loads!
|
So, just for fun I installed Previewer 2.4, same results.
Anything wrong with using MobiGen, or is it wise to use KindleGen nowadays? |
04-10-2012, 11:24 AM | #10 | |
Grand Sorcerer
Posts: 28,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
Just drag & drop the ePub containing those media queries onto the Previewer window, and it's built-in kindlegen will build the MOBI and correctly interpret the those new media queries for you (or the kindlegen command-line will do the same thing). |
|
04-11-2012, 10:50 PM | #11 |
Rookie Know-It-All
Posts: 7
Karma: 10
Join Date: Mar 2012
Location: South Florida
Device: I use them all!
|
I almost forgot about this post. Got some great info out of these posts so let me update my issue with queries.
In the OP, you can see I assigned a Media string in the <style> section for amzn-mobi. Everything is fine when I finish and preview in Kindle Previewer EXCEPT:
UPDATE: What I did at first was remove all @media jargon for epub version but it really bothered me that this wasnt working as everyone says it should. Now I havent tried using @import (mainly cuz I dont fully understand it YET! Im a rookie, remember!?) but what I did do that worked was I simply removed the media="amzn-mobi" from the <style> tags in every sheet and simply put (example CSS) on a seperate style sheet: Code:
@media amzn-mobi{ p { text-align:left; margin-top: 5px; margin-bottom:5px; } } Everything validates and works on all my machines as both epub and mobi. My end result is a validated EPUB that can be converted to mobi easily. |
05-29-2012, 01:03 PM | #12 |
Junior Member
Posts: 2
Karma: 10
Join Date: May 2012
Device: all
|
@AIR-WIZZ
I'm where you were at the start of this thread. I understand what you're saying about putting the mobi css on a separate style sheet, but where in the html do you point the reader to the second style sheet? I've found if I use no media queries, the epub looks and works great on Nook, Sony, iPad, Kobo, and Kindle Fire. With media queries (at the top of my css) it looks and works great on both Kindle formats and the iPad, but obviously breaks on the others. What am I missing? |
05-30-2012, 01:58 AM | #13 |
Junior Member
Posts: 2
Karma: 10
Join Date: Jul 2011
Device: Kindle, iPad, Nook
|
Adding the media query to html
Hey luckyparrot,
You point your html to all the stylesheets in the head of your html. If you've got more than one stylesheet, you'll need to create more than one link. So let's say you've got your handy mobi stylesheet and one for everything else. You'll do one, then the other: <head> <style type="text/css" media="amzn-mobi" href="css/mobi.css" /> <style type="text/css" media="not amzn-mobi" href="css/standard.css" /> </head> (where you replace the css/mobi.css and css/standard.css for the filepath to whatever and wherever you've named your files) You can keep listing and listing and listing different queries and associated stylesheets if you wanted. Just make sure you test at every step along the way. Some devices (ahem nook) get jealous if you list someone else's stylesheet before theirs. If you use @import or @media in your css, you shouldn't need a separate rule for everything not mobi, but if you really want to have everything in separate pretty categories, you can use not amzn-mobi to do that the same way you used amzn-mobi to target mobis. |
09-04-2012, 02:35 PM | #14 | |
Bemused by possibilities
Posts: 58
Karma: 480244
Join Date: Jul 2012
Device: iPad3, Kobo
|
Quote:
|
|
09-04-2012, 02:55 PM | #15 |
Bemused by possibilities
Posts: 58
Karma: 480244
Join Date: Jul 2012
Device: iPad3, Kobo
|
DiapDealder
Question: when I preview queries on Kindle Previewer or sideload on to Kindle for Mac and Kindle for iPad, results are that Kindle for Mac previews KF8 and Kindle for iPad and Kindle for iPhone preview/use mobi query both on devices and on Kindle Previewer. So conclusion: Kindle for iPhone and Kindle for iPad (not Kindle for Mac) use mobi query. However, someone said that they thought that when published, not previewed or sideloaded, that Kindle for iPhone and Kindle for iPad then use KF8. No idea why publishing would do this and Kindle Previewer wouldn't. Your experience? Anyone else? |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kindle Previewer issues | DanBenton | Kindle Formats | 4 | 01-27-2012 06:40 AM |
Queries re Kindle | mitch13 | Amazon Kindle | 7 | 07-01-2011 02:08 AM |
Kindle Previewer: Differences between Kindle and iPhone/iPad modes | Jackwritesbooks | Kindle Formats | 5 | 06-22-2011 01:25 PM |
Bugs in new Kindle Previewer v.1.6? | rglk | Amazon Kindle | 14 | 05-30-2011 03:42 PM |
The Kindle Previewer expected soon | Sheikspeare | Amazon Kindle | 2 | 07-04-2010 01:34 PM |