你能否完全用html语言写一个点击按钮弹出弹窗的代码,注意是赛博朋克风格的
时间: 2023-05-26 19:01:40 浏览: 155
A:
<html>
<head>
<title>Cyberpunk Pop-up</title>
<style>
body {
background-color: #141A2F;
font-family: 'Roboto Mono', monospace;
color: #8C8C8C;
}
.container {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.button {
outline: none;
border: none;
background-color: #7F5AF0;
color: #E5E5E5;
font-size: 2.5rem;
padding: 1.5rem 3.5rem;
border-radius: 0.5rem;
cursor: pointer;
box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.1);
transition: all 0.2s ease-in-out;
}
.button:hover {
box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.2);
transform: translateY(-2px);
}
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0,0,0,0.75);
display: flex;
justify-content: center;
align-items: center;
}
.pop-up {
background-color: #1B1C28;
width: 40%;
padding: 3.5rem 5.5rem;
border-radius: 0.75rem;
box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.2);
text-align: center;
}
h2 {
font-size: 2.5rem;
margin-bottom: 2rem;
}
p {
font-size: 1.5rem;
color: #8C8C8C;
margin-bottom: 3rem;
}
.close {
position: absolute;
top: 1.5rem;
right: 1.5rem;
font-size: 2rem;
color: #8C8C8C;
cursor: pointer;
}
.close:hover {
color: #E5E5E5;
}
</style>
</head>
<body>
<div class="container">
<button class="button" onclick="openPopUp()">Open Pop-Up</button>
<div class="overlay" id="overlay">
<div class="pop-up">
<span class="close" onclick="closePopUp()">✕</span>
<h2>Hello World!</h2>
<p>This is a cyberpunk styled pop-up.</p>
</div>
</div>
</div>
<script>
function openPopUp() {
document.getElementById("overlay").style.display = "flex";
}
function closePopUp() {
document.getElementById("overlay").style.display = "none";
}
</script>
</body>
</html>
阅读全文