【发布时间】:2017-11-16 07:17:44
【问题描述】:
我有一个带有背景图像和线性渐变叠加层的 div。当 div 悬停在上面时,我想将线性渐变转换为完全透明。
.board-grid {
display: flex;
justify-content: center;
flex-direction: row;
}
.board-focus {
margin: 10px;
background: #FFF;
text-decoration: None;
border-radius: 10px;
height:30vh;
width:25vw;
display: flex;
align-items: center;
justify-content: center;
}
.board-name {
text-transform: uppercase;
//max-width: 50%;
color: #FFF;
}
<div class="board-grid">
<a href=''>
<div class="board-focus" style="background: linear-gradient(0deg,rgba(0,0,0,0.5),rgba(0,0,0,0.5)), url(https://placeimg.com/480/300/any); background-size: cover; background-position: center center; background-repeat: no-repeat;">
<div class="board-name">
<p>John Doe</p>
</div>
</div>
</a>
</div>
【问题讨论】:
-
你不能转换渐变,只能调整它的背景位置/大小......如果我怀疑我们的样式 inline,你甚至不能这样做。跨度>
标签: html css hover linear-gradients