<!-- With HTML attributes -->
    <img data-twic-src="image:football.jpg" width="300" height="300">

    <!-- Same result with CSS -->
    <img data-twic-src="image:football.jpg" style="width:300px; height:300px;">

    <!-- Placeholder as a "cover" background image -->
    <div class="bg" data-twic-background="url(image:football.jpg)"></div>

main {
  max-width: 1000px;
  margin: auto;
  padding: 1em;

section {
  display: flex;
  justify-content: center;
  margin-bottom: 1em;

img {
  display: block;
  object-fit: cover;

figure {
  margin: 0;

.bg {
  width: 300px;
  height: 300px;
  background-size: cover;

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://demo.twic.pics/?v1