Skip to content

Instantly share code, notes, and snippets.

@hubgit
Last active May 12, 2025 09:45
Show Gist options
  • Select an option

  • Save hubgit/7025107 to your computer and use it in GitHub Desktop.

Select an option

Save hubgit/7025107 to your computer and use it in GitHub Desktop.
A5 printed card with HTML + CSS
@page {
size: A5;
margin: 0;
}
html {
background: #eee;
}
body {
/* A5 dimensions */
height: 210mm;
width: 148.5mm;
background: #fff;
margin: 0;
}
.face {
height: 50%;
width: 100%;
position: relative;
}
.face-back {
background: #f6f6f6;
}
.face-front img {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
width: 100%;
height: 100%;
}
<!doctype html>
<meta charset="utf-8">
<link rel="stylesheet" href="card.css">
<body>
<div class="face face-back"></div>
<div class="face face-front"><img src="front.png"></div>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment