【发布时间】:2019-07-06 15:47:04
【问题描述】:
我正在尝试设置卡片布局,当用户将鼠标悬停在卡片上时卡片会改变背景颜色。喜欢本页的卡片:https://texasdeafed.org/students/programs
我尝试在标题中添加悬停信息,我有阴影:
.card:hover {
background-color: #fffff
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}
示例:
.card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
transition: 0.3s;
width: 50%;
background-color: #DCE1E0;
}
.card:hover {
background-color: #fffff;
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
}
.container {
padding: 2px 5px;
}
<div class="card">
<br />
<center>
<h1>Family Weekend
<br />
<br />Retreat</h1>
</center>
<br />
<img src="/cms/lib6/TX01923182/Centricity/Domain/180/Shelly_Parent_Liaison_ca rdflipped.jpg" alt="Woman reading Parent Liaison card by texasdeafed.org" style="width:100%">
<div class="container">
<br />
<p>
A special weekend in Austin for families with deaf and hard of hearing children hosted by the Educational Resource Center on Deafness at Texas School for the Deaf </p>
<br />
<br />
<br />
</div>
</div>
我希望悬停颜色变为白色,但根本没有变化。
【问题讨论】:
-
您的白色颜色代码不正确。试试 #fff 或 #ffffff(3 或 6 个字符)
-
谢谢,我试过你的建议,但没有任何改变。
-
看到这个fiddle