Make A difference cards V5
Imports: 4

A short explanation. . .

Preview

Report Preview


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Two 3x4 Portrait Cards on One 4x6</title>

  <style>
    @page {
      /* A 4x6 print is 6" x 4" when laid out landscape */
      size: 6in 4in;
      margin: 0;
    }

    :root {
      /* Sheet size */
      --sheet-w: 6in;
      --sheet-h: 4in;

      /* Card size (portrait) */
      --card-w: 3in;
      --card-h: 4in;

      /* White border around photo area */
      --pad-top: 0.20in;
      --pad-side: 0.18in;
      --pad-bottom: 0.12in;

      /* Name bar is a fixed fraction of card height */
      --name-bar-h: calc(var(--card-h) * 0.18); /* 18% of 4in = 0.72in */

      --name-bg: #2D4C9B;
      --name-color: #ffffff;
      --name-font: 16px;
    }

    body {
      margin: 0;
      padding: 0;
      background: #ffffff;
    }

    /* One printed page equals one 4x6 sheet */
    .sheet {
      width: var(--sheet-w);
      height: var(--sheet-h);
      position: relative;
      background: #ffffff;
      page-break-after: always;
      box-sizing: border-box;
    }

    /* Each 3x4 card */
    .card {
      width: var(--card-w);
      height: var(--card-h);
      position: absolute;
      top: 0;
      background: #ffffff;
      overflow: hidden;
      box-sizing: border-box;
    }

    .card.left { left: 0; }
    .card.right { left: var(--card-w); }

    /* Photo area (leaves white border and keeps photo above name bar) */
    .photo-area {
      position: absolute;
      left: var(--pad-side);
      right: var(--pad-side);
      top: var(--pad-top);
      bottom: calc(var(--name-bar-h) + var(--pad-bottom));
      overflow: hidden;
      background: #ffffff;
      box-sizing: border-box;
    }

    .photo-area img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    /* Name bar */
    .name-box {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      height: var(--name-bar-h);
      background: var(--name-bg);
      color: var(--name-color);
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      font-size: var(--name-font);
      font-family: Avenir, Helvetica, Arial, sans-serif;
      line-height: 1.1;
      padding: 0 0.12in;
      box-sizing: border-box;
    }
  </style>
</head>

<body>
  {% for person in people %}
    {% if person.photo_url and person.photo_url != '' %}

      {% assign idx = forloop.index0 %}
      {% assign mod = idx | modulo: 2 %}

      {% if mod == 0 %}
        <div class="sheet">
          <div class="card left">
            <div class="photo-area">
              <img src="{{ person.photo_url }}" alt="{{ person.first_name }} {{ person.last_name }}">
            </div>
            <div class="name-box">
              {{ person.first_name }} {{ person.last_name }}
            </div>
          </div>
      {% else %}
          <div class="card right">
            <div class="photo-area">
              <img src="{{ person.photo_url }}" alt="{{ person.first_name }} {{ person.last_name }}">
            </div>
            <div class="name-box">
              {{ person.first_name }} {{ person.last_name }}
            </div>
          </div>
        </div>
      {% endif %}

      {% if forloop.last and mod == 0 %}
        </div>
      {% endif %}

    {% endif %}
  {% endfor %}
</body>
</html>