ダイアログボックス:レトロゲーミング|Dialog Box: Retro Gaming

Retro Gaming Dialog

This dialog features a nostalgic retro gaming design with pixel art aesthetics and vintage color schemes.

HTML
<div class="container">
    <button id="dialog-btn">Retro Gaming<br>Dialog</button>     
</div>

<!-- Dialog Window -->
<div id="dialog" class="dialog">
    <div class="dialog-content">
        <div class="retro-header">
            <span>Retro Gaming Dialog</span>
        </div>
        <div class="retro-body">
            <p>This dialog features a nostalgic retro gaming design with pixel art aesthetics and vintage color schemes.</p>
        </div>
        <div class="retro-footer">
            <button class="retro-btn">Start Game</button>
        </div>
    </div>
</div>
CSS
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    text-align: center;
}

#dialog-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 200px;
    min-height: 60px;
    display: inline-block;
    text-align: center;
    line-height: 1.4;
    vertical-align: middle;
}

#dialog-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.dialog {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.dialog-content {
    width: 80%;
    max-width: 500px;
    margin: 8% auto;
    background: #222;
    border: 4px solid #00ff00;
    border-radius: 8px;
    box-shadow: 0 0 0 4px #111, 0 8px 0 0 #00ff00, 0 12px 24px #000;
    overflow: hidden;
    font-family: 'Press Start 2P', 'MS Gothic', 'monospace';
    color: #00ff00;
    letter-spacing: 1px;
    text-shadow: 0 0 6px #00ff00, 0 0 2px #fff;
    animation: slideInFromTop 0.3s ease-out;
}

.retro-header {
    background: #111;
    color: #00ff00;
    padding: 15px 20px;
    text-align: center;
    border-bottom: 2px solid #00ff00;
    position: relative;
}

.retro-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: repeating-linear-gradient(90deg, #00ff00 0 6px, transparent 6px 12px);
    opacity: 0.7;
}

.retro-header span {
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 6px #00ff00, 0 0 2px #fff;
    border-bottom: 2px solid #00ff00;
    padding-bottom: 8px;
    position: relative;
}

.retro-body {
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
}

.retro-body p {
    margin: 0;
    line-height: 1.7;
    color: #00ff00;
    font-size: 12px;
    text-shadow: 0 0 4px #00ff00;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 0 0 0;
    border-top: 1px dashed #00ff00;
}

.retro-footer {
    padding: 20px;
    text-align: center;
    background: #111;
    border-top: 2px solid #00ff00;
}

.retro-btn {
    background: #00ff00;
    color: #000;
    border: 3px solid #00ff00;
    padding: 10px 20px;
    border-radius: 0;
    cursor: pointer;
    font-family: 'Press Start 2P', 'MS Gothic', 'monospace';
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.1s ease;
    box-shadow: 4px 4px 0 #000, inset -2px -2px 0 rgba(255, 255, 255, 0.3);
    text-shadow: none;
}

.retro-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 #000, inset -2px -2px 0 rgba(255, 255, 255, 0.3);
}

.retro-btn:active {
    transform: translate(0, 0);
    box-shadow: 2px 2px 0 #000, inset -2px -2px 0 rgba(255, 255, 255, 0.3);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .dialog-content {
        width: 90%;
        margin: 15% auto;
    }
    
    .retro-header span {
        font-size: 14px;
    }
    
    .retro-body p {
        font-size: 10px;
    }
}
JavaScript
document.addEventListener('DOMContentLoaded', function() {
    const dialogBtn = document.getElementById('dialog-btn');
    
    dialogBtn.addEventListener('click', function() {
        const dialog = document.getElementById('dialog');
        if (dialog) {
            dialog.style.display = 'block';
            document.body.style.overflow = 'hidden';
        }
    });
    
    const closeBtn = document.querySelector('.retro-btn');
    
    closeBtn.addEventListener('click', function() {
        const dialog = this.closest('.dialog');
        if (dialog) {
            dialog.style.display = 'none';
            document.body.style.overflow = 'auto';
        }
    });
});
よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!
目次