Dialog / 27 メタリック|Metallic
デザイン見本
複数の `linear-gradient` を重ね合わせてクロムやシルバーのような鋭い反射を表現した金属性のアピアランスです。背景の輝きはアニメーションでループすることで常に光っているような錯覚を引き起こします。
実装コード
HTML
<button id="dialog-btn-27">Metallic<br>Dialog</button>
<div id="dialog-27" class="dialog">
<div class="dialog-content-27">
<div class="metallic-header">
<span>Metallic Dialog</span>
</div>
<div class="metallic-body">
<p>クロムやシルバー金属のような冷たく鋭い質感のダイアログです。</p>
</div>
<div class="metallic-footer">
<button class="close-btn-27">Cancel</button>
<button class="close-btn-27 primary">Apply</button>
</div>
</div>
</div>
CSS
#dialog-btn-27 {
background: linear-gradient(to bottom, #ececec 0%, #cccccc 50%, #b3b3b3 51%, #a6a6a6 100%);
color: #444;
border: 1px solid #999;
padding: 12px 24px;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
font-weight: 800;
min-width: 200px;
min-height: 60px;
display: block;
margin: 0 auto;
text-align: center;
transition: all 0.1s;
box-shadow:
inset 0 1px 0 rgba(255,255,255,1),
0 4px 6px rgba(0,0,0,0.3),
0 1px 2px rgba(0,0,0,0.2);
text-shadow: 0 1px 0 rgba(255,255,255,0.8);
}
#dialog-btn-27:active {
background: linear-gradient(to bottom, #a6a6a6 0%, #b3b3b3 50%, #cccccc 51%, #ececec 100%);
box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
text-shadow: none;
color: #222;
}
#dialog-27 {
display: none;
position: fixed;
z-index: 2147483647;
left: 0; top: 0; width: 100%; height: 100%;
background-color: rgba(40, 45, 50, 0.7);
animation: fadeIn-27 0.3s;
}
.dialog-content-27 {
background: linear-gradient(135deg, #d4d4d4 0%, #ffffff 20%, #d4d4d4 40%, #999999 50%, #d4d4d4 60%, #ffffff 80%, #d4d4d4 100%);
background-size: 200% 200%;
animation: metalShine-27 4s linear infinite, swingIn-27 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
border-radius: 8px;
border: 1px solid #777;
width: 80%;
max-width: 480px;
margin: 10% auto;
position: relative;
padding: 30px;
text-align: center;
color: #333;
box-shadow:
inset 0 2px 3px rgba(255,255,255,0.9),
inset 0 -2px 3px rgba(0,0,0,0.3),
0 15px 30px rgba(0,0,0,0.5);
}
@keyframes metalShine-27 {
0% { background-position: 0% 0%; }
100% { background-position: 200% 200%; }
}
.dialog-content-27::before {
content: '';
position: absolute;
top: 5px; left: 5px; right: 5px; bottom: 5px;
border: 1px solid rgba(255,255,255,0.6);
border-radius: 3px;
pointer-events: none;
}
.metallic-header {
margin-bottom: 20px;
}
.metallic-header span {
font-size: 22px;
font-weight: 800;
color: #444;
text-shadow: 1px 1px 0 rgba(255,255,255,0.8), -1px -1px 0 rgba(0,0,0,0.3);
letter-spacing: 1px;
}
.metallic-body p {
font-size: 15px;
line-height: 1.6;
margin-bottom: 30px;
color: #222;
font-weight: 600;
text-shadow: 1px 1px 0 rgba(255,255,255,0.5);
}
.metallic-footer {
display: flex;
justify-content: center;
gap: 20px;
}
.close-btn-27 {
background: linear-gradient(to bottom, #e0e0e0 0%, #c0c0c0 50%, #aaaaaa 51%, #999999 100%);
color: #333;
border: 1px solid #888;
padding: 10px 25px;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
font-weight: 700;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 2px 4px rgba(0,0,0,0.2);
text-shadow: 0 1px 0 rgba(255,255,255,0.6);
transition: all 0.1s;
}
.close-btn-27.primary {
background: linear-gradient(to bottom, #d6eaf8 0%, #aed6f1 50%, #85c1e9 51%, #5dade2 100%);
border-color: #3498db;
color: #154360;
}
.close-btn-27:active {
background: linear-gradient(to bottom, #999999 0%, #aaaaaa 50%, #c0c0c0 51%, #e0e0e0 100%);
box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
text-shadow: none;
}
.close-btn-27.primary:active {
background: linear-gradient(to bottom, #5dade2 0%, #85c1e9 50%, #aed6f1 51%, #d6eaf8 100%);
}
@keyframes fadeIn-27 {
from { opacity: 0; } to { opacity: 1; }
}
@keyframes swingIn-27 {
0% { transform: perspective(400px) rotateX(-90deg); opacity: 0; }
50% { transform: perspective(400px) rotateX(15deg); }
100% { transform: perspective(400px) rotateX(0deg); opacity: 1; }
}
@media (max-width: 768px) {
.dialog-content-27 { width: 90%; padding: 20px; }
}
JS
(function () {
var btn = document.getElementById('dialog-btn-27');
var dialog = document.getElementById('dialog-27');
var closeBtns = dialog.querySelectorAll('.close-btn-27');
if (!btn || !dialog) return;
function openDialog() {
dialog.style.display = 'block';
document.body.style.overflow = 'hidden';
}
function closeDialog() {
dialog.style.display = 'none';
document.body.style.overflow = 'auto';
}
btn.addEventListener('click', openDialog);
closeBtns.forEach(function(b) { b.addEventListener('click', closeDialog); });
dialog.addEventListener('click', function (e) {
if (e.target === dialog) {
closeDialog();
}
});
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape' && dialog.style.display === 'block') {
closeDialog();
}
});
})();