Mobileread
CSS in Google Play Books vs Nook and others
#1  codys 07-11-2019, 10:02 AM
I'm testing some epubs in GPB and Nook, and some of the basic CSS is rendering fine in Nook but not GPB. Specifically, text-align:center is being ignored in GBP (there's probably more, but that's the most obvious).

I'm still somewhat new to all of this, and the posts complaining about GPB and CSS were back from 2014. So is GPB still crummy with respect to CSS? Or is there something else I should be doing?

BTW, I'm using Calibre.
Reply 

#2  lumpynose 07-11-2019, 01:13 PM
Dummy here; how do you open an epub in GPB? I think I tried with one in the Downloads folder but didn't succeed.
Reply 

#3  Nate the great 07-11-2019, 02:49 PM
Quote lumpynose
Dummy here; how do you open an epub in GPB? I think I tried with one in the Downloads folder but didn't succeed.
You have to upload the ebook to Play Books before you can open it in the app.

It is weird, yes.
Reply 

#4  lumpynose 07-11-2019, 03:39 PM
Thanks. It took several minutes to process a short book, The Pilgrim's Progress in Words of One Syllable, by Lucy Aikin (& John Bunyan), which is about 100k.

Quote Nate the great
It is weird, yes.
Well, it is google.

It's nice to have another platform to test on.
Reply 

#5  graycyn 07-13-2019, 01:51 AM
Quote codys
I'm testing some epubs in GPB and Nook, and some of the basic CSS is rendering fine in Nook but not GPB. Specifically, text-align:center is being ignored in GBP (there's probably more, but that's the most obvious).



I'm still somewhat new to all of this, and the posts complaining about GPB and CSS were back from 2014. So is GPB still crummy with respect to CSS? Or is there something else I should be doing?



BTW, I'm using Calibre.

As far as I have seen, Google Play Books renders text-align: center correctly. I've so far been completely happy with the way my books appear in Play Books. About the only thing I've noticed that isn't as I intend is that TOC links are bright blue. Clearly there's a CSS override there, but no biggie.






Sent from my iPad using Tapatalk
Reply 

#6  Hitch 07-13-2019, 12:52 PM
Quote codys
I'm testing some epubs in GPB and Nook, and some of the basic CSS is rendering fine in Nook but not GPB. Specifically, text-align:center is being ignored in GBP (there's probably more, but that's the most obvious).

I'm still somewhat new to all of this, and the posts complaining about GPB and CSS were back from 2014. So is GPB still crummy with respect to CSS? Or is there something else I should be doing?

BTW, I'm using Calibre.
codys:

How are you centering that text that is not rendering correctly, please?

Hitch
Reply 

#7  codys 07-19-2019, 12:20 PM
Quote Hitch
codys:

How are you centering that text that is not rendering correctly, please?

Hitch
Hi Hitch.

Here is an example:

From the text:

Code
<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head> <title>Lorem Ipsum</title> <link href="stylesheet.css" rel="stylesheet" type="text/css"/> <link href="page_styles.css" rel="stylesheet" type="text/css"/>
</head>
<body class="calibre"> <h3 class="block_3" id="toc_id_87">Introduction</h3>
...
From stylesheet.css

Code
...
.block_3 { display: block; line-height: 1.2; text-align: center; font-size: 1.0em; font-weight: normal; text-decoration: underline; margin: 12pt 0 3pt; padding: 0 }
...
.calibre { color: #000; display: block; font-family: "Times New Roman", serif; font-size: 1em; line-height: 1.2; padding-left: 0; padding-right: 0; margin: 0 5pt
...
Entirety of page_styles.css:

Code
@page { margin-bottom: 5pt; margin-top: 5pt }

This is how it looks:

image »
Reply 

#8  DNSB 07-19-2019, 01:31 PM
How does your stylesheet fare when checked with the W3C stylesheet validator? I don't remember the calibre editor having the ability to validate stylesheets so you may have to upload the stylesheet to W3C CSS Validation Service.
Reply 

#9  Hitch 07-19-2019, 09:47 PM
Quote codys
Hi Hitch.

Here is an example:

From the text:

Code
<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head> <title>Lorem Ipsum</title> <link href="stylesheet.css" rel="stylesheet" type="text/css"/> <link href="page_styles.css" rel="stylesheet" type="text/css"/>
</head>
<body class="calibre"> <h3 class="block_3" id="toc_id_87">Introduction</h3>
...
From stylesheet.css

Code
...
.block_3 { display: block; line-height: 1.2; text-align: center; font-size: 1.0em; font-weight: normal; text-decoration: underline; margin: 12pt 0 3pt; padding: 0 }
...
.calibre { color: #000; display: block; font-family: "Times New Roman", serif; font-size: 1em; line-height: 1.2; padding-left: 0; padding-right: 0; margin: 0 5pt
...
Entirety of page_styles.css:

Code
@page { margin-bottom: 5pt; margin-top: 5pt }

This is how it looks:

image »

Well, the thing is, with CSS...you have that whole pesky inheritance thing. do you have any paragraph styles or heading styles that are upstream of that? What are your style classes for your h, h1-h6 classes?

Hitch
Reply 

Today's Posts | Search this Thread | Login | Register