Custom CSS in AMP posts

Posted in: Newspaper
Post count: 70

Hello,

I’m using custom HTML and CSS on my website, some kind of articles have 2-4 tables. I discovered that the AMP posts/pages doesn’t inject my custom CSS, as you can see from here (my developing/test website):
screenshot-1

Here is how it appears on PC No-AMP version:
screenshot-2

So the question is, is there a way to inject my custom CSS in the AMP version?

Thank you.

Post count: 23312

Hello Kley,

You should use a bit of CSS code if you want to change the AMP style page. Edit here -> https://www.screencast.com/t/vIUHFAbD6uRH There’s no option for custom CSS code for AMP version, sorry! You need to follow the above advice if you want to customize your AMP version.

Thanks for your understanding!

Post count: 70

Hi,

I’ve tried to use the method you described but seems that it doesn’t work to me.

I have added this to style.php file:

echo '
CSS CODE
';

My CSS is a bit long, nearly 950 lines and composed by IDs and Classes. I’ve also tried to use the minified version.

Post count: 23312

Hello Kley,

This advice has been tested on my side and it works good, as you can see here -> https://www.screencast.com/t/f3Vbe0PJsum

Thanks for your understanding!

Post count: 70

Yeah, the error was the semicolon i added at the end of the code ';.
Anyway, now it works great but only on the mobile version: the AMP has 2 versions (main classes), amp-touch and amp-mouse, so it works only on the touch version. How can i make it work in both AMP versions?

Thank you 🙂

Post count: 70

Fixed. It was the cache, sorry. I deactivated the cache on the production site instead of the test site xD
Now everything works fine!

Thanks again and sorry for the mistake.

Viewing 6 posts - 1 through 6 (of 6 total)
The forum ‘Newspaper’ is closed to new topics and replies.