我嘗試在另一個div上使用position
div。
當我徘徊在.lg-each-contest
上時會出現.current-caption
。 當盤旋在.time
上時.current-caption
懸停將相同。CSS位置懸停時無法正常工作
這裏是我的代碼
.lg-current-inner {
border: 1px solid #bdbdbd;
margin-bottom: 30px;
position: relative;
}
.lg-each-contest:hover .current-caption {
opacity: 1;
}
.lg-current-banner .amount {
position: absolute;
top: 5px;
background-color: #fea700;
padding: 5px 12px;
font-size: 22px;
right: 0;
font-weight: 600;
color: #fff;
}
.lg-current-content {
padding: 10px;
}
.lg-current-content h3 {
font-size: 24px;
line-height: 36px;
margin-top: 10px;
}
.time {
border-top: 1px solid #bdbdbd;
position: relative;
}
.time .remaning-time {
padding: 10px;
}
.time .remaning-time .each-time {
font-size: 14px;
font-weight: 500;
}
.time .remaning-time .submissions {
padding: 2px 10px;
background: #1bcd80;
font-weight: 500;
color: #fff;
border-radius: 2px;
}
.current-caption {
position: absolute;
top: 0;
left: 0;
cursor: pointer;
right: 0;
bottom: 0;
padding: 25% 0;
width: 100%;
height: 100%;
background-color: rgba(63, 97, 132, 0.5);
text-align: center;
font-size: 15px;
opacity: 0;
-webkit-transition: all 0.4s ease-out;
-moz-transition: all 0.4s ease-out;
-o-transition: all 0.4s ease-out;
-ms-transition: all 0.4s ease-out;
transition: all 0.4s ease-out;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.current-caption button {
color: #fea700;
padding: 6px 20px;
opacity: 1;
border-radius: 4px;
background: #fff;
font-weight: 600;
font-size: 16px;
position: relative;
top: 50%;
outline-color: transparent;
border: none;
}
.current-caption button:hover {
border-color: transparent;
border: none;
}
.current-caption button:focus {
border-color: transparent;
border: none;
}
.current-caption button .fa {
margin-right: 5px;
}
.seclected {
display: none;
}
<div class="lg-current-inner">
<div class="lg-each-contest">
<div class="lg-current-banner">
<img src="assets/images/gl-1.jpg" alt="" class="img-responsive">
<span class="amount">$130</span>
</div>
<div class="lg-current-content">
<h3>Logo Name here</h3>
<p>We are looking for a clean logol company strickt.</p>
</div>
<div class="current-caption">
<button class="select-btn">
<span class="select">Select</span>
<span class="seclected select">Selected</span>
</button>
</div>
</div>
<div class="time">
<div class="remaning-time">
<span class="each-time"> 25 Days 13 Hours 00 min</span>
<span class="pull-right submissions" data-toggle="tooltip" data-placement="top" title="Submissions" data-toggle="tooltip" data-placement="top" title="Submissions">344</span>
</div>
</div>
</div>
檢查演示:http://codepen.io/anon/pen/MpoMad?editors=1100
在此先感謝。
'但是第二格的文字成了首位。這意味着什麼? – Nitheesh
那麼,你到底想達到什麼目的? –
爲什麼不添加'z-index:999;'到'.current-caption' – linktoahref