DEV Community

Dominik Bálló
Dominik Bálló

Posted on

Little HTML trick, random image

This is a little HTML trick to generate random image every time you open the page or refresh it:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>PicSum</title>
  </head>
  <body>
    <h1>PicSum</h1>
    <h2><a href="#" onclick="location.reload()">Refresh</a></h2>
    <br />
    <img src="https://picsum.photos/500/600" alt="Random image" />
    <br />
  </body>
</html>
Enter fullscreen mode Exit fullscreen mode

Top comments (0)