AMP

继续

恭喜,您已构建了您的第一个 AMP 页面!它应该看起来像下面的示例

<!DOCTYPE html>
<html >
  <head>
    <meta charset="utf-8" />
    <title>My AMP Page</title>
    <link rel="canonical" href="self.html" />
    <meta name="viewport" content="width=device-width" />
    <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
    <script async src="https://cdn.ampproject.org/v0.js"></script>
    <script async custom-element="amp-base-carousel" src="https://cdn.ampproject.org/v0/amp-base-carousel-0.1.js"></script>
    <style amp-custom>
      h1 {
        margin: 1rem;
      }
       body {
        background-color: blue;
      }
    </style>
  </head>
  <body>
    <h1 id="hello">Hello AMPHTML World!</h1>
    <amp-base-carousel loop="true"  width="600" height="400" layout="responsive">
        <amp-img src="https://source.unsplash.com/Ji_G7Bu1MoM/600x400" width="600" height="400" layout="responsive"></amp-img>
        <amp-img src="https://source.unsplash.com/4yCXNMLP9g8/600x400" width="600" height="400" layout="responsive"></amp-img>
        <amp-img src="https://source.unsplash.com/QrgRXH81DXk/600x400" width="600" height="400" layout="responsive"></amp-img>
        <amp-img src="https://source.unsplash.com/8QJSi37vhms/600x400" width="600" height="400" layout="responsive"></amp-img>
    </amp-base-carousel>
    <button on="tap:hello.hide">
      Goodbye AMPHTML World!
    </button>
  </body>
</html>
在 playground 中打开此代码片段

既然您已开始使用 AMP,接下来呢?

使用 AMP 和您最喜欢的框架或 CMS 构建网站

许多框架和 CMS 都集成了 AMP,例如 Eleventy 和 WordPress。请在此处查看完整列表并开始使用!

将 AMP 与内部解决方案集成

AMP 是一个前端框架,您可以将其与您的后端解决方案集成。使用可用工具AMP 优化器来充分利用 AMP!

使用 AMP 学习 Web 开发

如果您是 Web 开发新手,您可以从AMP 的 Web 开发课程开始您的旅程! 这三门免费课程已在世界各地的学校和培训课程中使用。现在您可以在我们的网站上在线学习它们。它们适合初学者和经验丰富的 Web 开发人员,它们将带您从零到 AMP!