Popup / 02 カードスタイル|Card Style
デザイン見本
Card Style Popup
カード風の見た目を持つポップアップウィンドウです。
僅かに傾きをつけたカード風のデザインです。背景に微細なグラデーションとシャドウを適用し、モダンで洗練された印象を与えます。
実装コード
HTML
<div id="popup-container-2">
<button id="popup-btn-2">Card Style</button>
</div>
<div id="popup-2" class="popup-2">
<div class="popup-content-2">
<p>Card Style Popup</p>
<p>カード風の見た目を持つポップアップウィンドウです。</p>
</div>
</div>
CSS
/* Button Style */
#popup-btn-2 {
cursor: pointer;
border: none;
padding: 12px 24px;
border-radius: 16px;
color: #333;
background-color: #eee;
font-weight: 600;
box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
display: block;
margin: 0 auto;
width: 180px;
}
#popup-btn-2:hover {
opacity: 0.5;
}
/* Popup Style */
.popup-2 {
position: fixed;
bottom: -100%;
left: 50%;
transform: translateX(-50%);
z-index: 1001;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease;
max-width: 90%;
max-height: 90%;
}
.popup-2.active {
opacity: 1;
visibility: visible;
bottom: 20px;
transform: translateX(-50%);
animation: popupShowHide2 3.4s ease forwards;
}
@keyframes popupShowHide2 {
0% {
opacity: 0;
transform: translateX(-50%) translateY(100%);
}
20% {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
80% {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
100% {
opacity: 0;
transform: translateX(-50%) translateY(100%);
}
}
.popup-content-2 {
background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
padding: 30px;
border-radius: 20px;
text-align: center;
position: relative;
min-width: 300px;
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1), 0 5px 15px rgba(0, 0, 0, 0.05);
border: 1px solid #e9ecef;
transform: rotate(-1deg);
}
.popup-content-2::before {
content: '';
position: absolute;
top: -2px;
left: -2px;
right: -2px;
bottom: -2px;
background: linear-gradient(45deg, #28a745, #20c997);
border-radius: 22px;
z-index: -1;
opacity: 0.1;
}
.popup-content-2 p:first-child {
font-size: 24px;
font-weight: bold;
margin-bottom: 15px;
color: #28a745;
text-shadow: 0 1px 2px rgba(40, 167, 69, 0.1);
}
.popup-content-2 p:last-of-type {
font-size: 16px;
color: #666;
margin-bottom: 25px;
line-height: 1.6;
}
JS
var btn = document.getElementById('popup-btn-2');
var popup = document.getElementById('popup-2');
if (btn && popup) {
btn.addEventListener('click', function () {
popup.classList.add('active');
});
popup.addEventListener('animationend', function () {
popup.classList.remove('active');
});
}