<!DOCTYPE html>
<html>
  <head>
    <style>
      * {
        box-sizing: border-box;
      }
      body {
        display: flex;
        flex-direction: column;
        align-items: center;
      }
      body img {
        height: auto;
        width: 100vw;
        max-width: 400px;
      }
    </style>
  </head>
  <body>
    <script src="https://cdn.rawgit.com/github/fetch/master/fetch.js"></script>
    <script src="script.js"></script>
  </body>
</html>
const apiKey = 'dc6zaTOxFJmzC'
fetch(`https://api.giphy.com/v1/gifs/trending?api_key=${apiKey}`)
  .then(response => response.json())
  .then(json => {
    json.data
      .map(gif => gif.images.fixed_height.url)
      .forEach(url => {
        let img = document.createElement('img')
        img.src = url
        document.body.appendChild(img)
      })
  })
  .catch(error => document.body.appendChild = error)