爲什麼當按下第一個按鈕時,第二個按鈕將不透明。 但是當按下第二個按鈕時,第一個按鈕會得到不透明度?CSS不適用於其中一個按鈕
當按下第一個按鈕時,可以在關閉彈出窗口時按下第二個按鈕。
非常感謝大家的幫助!
<style>
body {
background-color:#121212;
}
.one {
color: #DEDEDE;
font-size: 65px;
text-decoration: none;
text-align: center;
width: 80px;
height:0;
padding-bottom: 80px;
border-radius: 80px;
border:3px solid #cfdcec;
overflow:hidden;
float:left;
position:absolute;
transition: .5s ease;
top: 180px;
left: 140px;
text-align: center;
text-vertical-align: middle;
}
.two {
color: #DEDEDE;
font-size: 65px;
text-decoration: none;
text-align: center;
width: 80px;
height:0;
padding-bottom: 80px;
border-radius: 80px;
border:3px solid #cfdcec;
overflow:hidden;
float:left;
position:absolute;
transition: .5s ease;
top: 180px;
left: 240px;
text-align: center;
text-vertical-align: middle;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.8);;
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: orange;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
</style>
</head>
<body>
<a class="one" href="#popup1">1</a>
<div id="popup1" class="overlay">
<div class="popup">
<h2>Here i am</h2>
<a class="close" href="#">×</a>
<div class="content">
1
</div>
</div>
</div>
<a class="two" href="#popup2">2</a>
<div id="popup2" class="overlay">
<div class="popup">
<h2>Here i am</h2>
<a class="close" href="#">×</a>
<div class="content">
2
</div>
</div>
</div>
</body>
</html>
如果添加CSS的標記,以便人們可以找到你的問題更容易 – cuadraman