Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accelerated mobile pages link to css file

I am trying to link to css file :

<link href="/semanticui/semantic.css" rel="stylesheet" />

Opening chrome in #development=1 mode to test my page for amp. I am getting this error :

The attribute 'href' in tag 'link rel=stylesheet for fonts' is set to the invalid value '/semanticui/semantic.css'.
like image 507
osmanraifgunes Avatar asked Mar 20 '16 22:03

osmanraifgunes


People also ask

How do I Make my CSS only work with mobile devices?

What you need first, is to use @media queries, you can do it either in the CSS file itself, or in the html file. What you have to do, is add some extra rules only for smartphones, below your normal css rules. Using the example below, you add inside the curly brackets the lines you need to change your normal CSS to one that mobile devices can use.

What is the Accelerated Mobile Pages project?

Take your JavaScript to the next level at Frontend Masters . The Accelerated Mobile Pages (AMP) Project is an initiative to improve the mobile web and enhance the distribution ecosystem.

Why Accelerated Mobile Pages (AMP)?

The Accelerated Mobile Pages (AMP) Project is an initiative to improve the mobile web and enhance the distribution ecosystem. If content is fast, flexible and beautiful, including compelling and effective ads, we can preserve the open web publishing model as well as the revenue streams so important to the sustainability of quality publishing.

What is the Accelerated Mobile Pages Codelab?

Overview This codelab is a continuation of the concepts introduced in Accelerated Mobile Pages Foundations. You should already have completed the previous code lab before starting this lab or at least have a basic understanding AMP's core concepts already.


2 Answers

External stylesheets are not permitted. Use inline styling to avoid the additional request for css.

More info can be found at: https://github.com/ampproject/amphtml/blob/master/spec/amp-html-format.md#stylesheets

Authors may add custom styles to a document using a single <style amp-custom> tag in the head of the document.

like image 173
Jeff Deskins Avatar answered Oct 23 '22 01:10

Jeff Deskins


i am using php pages so I do the following to add my custom css page, so i can seperate it and also include in all pages so changing only once etc.

<style amp-custom>
  <?php readfile( getcwd() . "/css/main.min.css"); ?>
</style>
like image 33
Simon Davies Avatar answered Oct 23 '22 02:10

Simon Davies