HTMLコード
<div class="creditcard">
<span class="logo">GOLD CARD</span>
<span class="card-number">1234 5678 9876 5432</span>
<span class="expiry-date">有効期限 12/25</span>
<span class="card-holder">TANAKA MINORU</span>
<span class="cvv">CVV 123</span>
<span class="hologram"></span>
<span class="chip"></span>
</div>
CSSコード
.creditcard {
max-width: 300px;
min-height: 185px;
color: #000;
background: linear-gradient(145deg,#fff233, #d9cb00, #b19e00, #d9c100, #fff233, #d9c100, #b19500, #d9b700, #fff233);
border: outset 1px rgba(0, 0, 0, 0.2);
box-shadow: 2px 2px 5px -3px rgba(0, 0, 0, 0.8),
inset 1px 1px 1px rgba(255, 255, 255, 0.8);
text-shadow: 0.5px 0.5px 1px rgba(0, 0, 0, 0.2);
padding: 15px;
border-radius: 15px;
margin: 20px auto;
aspect-ratio: 1.618/1;
box-sizing: border-box;
overflow: hidden;
display: flex;
flex-direction: column;
justify-content: space-between;
font-family: "Courier New", monospace, sans-serif;
position: relative;
font-size: 16px;
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.logo {
font-size: 1.8em;
font-weight: bold;
text-align: left;
margin-bottom: 35px;
text-shadow: 2px 2px 2px rgba(0, 0, 0, 0.2),
-2px -2px 1px rgba(255, 255, 255, 0.4);
color: #220;
}
.card-number {
font-size: 1.3em;
margin-bottom: 15px;
text-align: right;
font-weight: bold;
font-family: "Consolas", "Roboto Mono", "Menlo", "Courier New", monospace;
letter-spacing: 1px;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3),
-1px -1px 1px rgba(255, 255, 255, 0.5);
color: #220;
}
.expiry-date,
.card-holder {
font-size: 0.9em;
display: block;
margin-bottom: 5px;
}
.card-holder {
text-transform: uppercase;
}
.cvv {
font-size: 0.9em;
opacity: 0.8;
position: absolute;
bottom: 10px;
right: 70px;
}
.chip {
position: absolute;
top: 45px;
left: 15px;
width: 40px;
height: 30px;
background: linear-gradient(135deg, #bbb, #ddd);
border-radius: 5px;
}
.chip::after {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image:
linear-gradient(90deg, transparent 50%, rgba(0, 0, 0, 0.05) 50%),
linear-gradient(0deg, transparent 50%, rgba(0, 0, 0, 0.05) 50%);
background-size: 4px 4px;
opacity: 0.5;
}
.hologram {
position: absolute;
bottom: 10px;
right: 15px;
width: 50px;
height: 30px;
background: linear-gradient(45deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f);
opacity: 0.3;
border-radius: 5px;
}
.creditcard:hover {
transform: rotateY(5deg) rotateX(20deg);
box-shadow: 5px 8px 8px -3px rgba(0, 0, 0, 0.2),
inset 1px 1px 1px rgba(255, 255, 255, 0.8);
}
.creditcard::after {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(
145deg,
rgba(255, 255, 255, 0.3) 0%,
rgba(255, 255, 255, 0) 50%,
rgba(0, 0, 0, 0.1) 100%
);
opacity: 0;
transition: opacity 0.3s ease, background 0.3s ease;
}
.creditcard:hover::after {
opacity: 1;
background: linear-gradient(
145deg,
rgba(255, 255, 255, 0.4) 0%,
rgba(255, 255, 255, 0) 50%,
rgba(0, 0, 0, 0.1) 100%
);
}