Help Save Code2care! 😢

I've lost 99% of my revenue to AdBlockers & AI. Your support could be the lifeline that keeps this passion project alive!

Buy Code2care a Coffee QR Code

Scan to Buy Me A Coffee and help me continue coding for you!

Amp Hello World Example


Now that Google recommends you to enhance your webpages for mobile devices, you would need to customize your website to render AMP as well, here is a Hello World! boilerplate code to get started!

<!doctype html>
<html ⚡>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
    <meta name="description" content="Hello World AMP!">
    <link rel="preload" as="script" href="https://cdn.ampproject.org/v0.js">
    <script async src="https://cdn.ampproject.org/v0.js"></script>
	
    <style amp-custom>
     .message {
	  margin:10px;
	  padding:10px;
	  border:1px solid #ccc;
	 }
    </style>
	
    <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>

    <title>AMP: Hello World Code!</title>
  </head>
  <body>
    <h1>Hello World!</h1>
	<p class="message">This is a hello world example using html5 page customized with AMP!</p>
  </body>
</html>
Author Info:

Rakesh (He/Him) has a Masters Degree in Computer Science with over 15+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright Code2care © 2024 | Privacy Policy | About Us | Contact Us | Search