【发布时间】:2019-04-16 06:51:02
【问题描述】:
我在这里摸不着头脑:我有几个 div 在悬停时转换,但我试图在锚链接上重新创建相同的,但我无法让它适合。一辈子都找不到原因!
编辑:所以我忘了描述我的问题,哎呀! 基本上,两个黄色按钮是我可以做的:一个转换,但是只有文本而不是黄色区域可以作为链接点击。另一个黄色按钮是完全可点击的,所以完成按钮是一个链接,但它不会转换。我想在这些黄色按钮上进行转换,以匹配“项目图块”缩略图的转换。
到目前为止,这是我的代码(抱歉,如果格式没有通过 - 第一篇!):
/* This anchor's button isn't fully clickable */
.prolink {
background: yellow;
width: 100px;
padding: 10px 20px;
margin: 30px auto;
border: 2px solid black;
border-radius: 25px;
box-shadow: 0 3px 8px 0 rgba(0, 0, 0, 0.3);
transition: transform 350ms;
}
.prolink:hover {
background: var(--hoveryellow);
color: var(--deepblue);
transform: scale(1.08);
}
/* This anchor won't transition */
#pro-link-text {
background: yellow;
width: 100px;
padding: 10px 20px;
margin: 30px auto;
border: 2px solid black;
border-radius: 25px;
box-shadow: 0 3px 8px 0 rgba(0, 0, 0, 0.3);
transition: transform 350ms;
}
#pro-link-text:hover {
background: var(--hoveryellow);
color: var(--deepblue);
transform: scale(1.08);
}
<!-- This transition works -->
<!-- But the surrounding area on this anchor button isn't fully clickable -->
<div class="prolink">
<a href="https://www.freecodecamp.org/fitfingers" target="_blank" id="profile-link">More Projects</a>
</div>
<!-- But this anchor won't transition -->
<a href="https://www.freecodecamp.org/fitfingers" target="_blank" id="pro-link-text">More Projects</a>
我发誓,它在 CodePen 中的格式正确,哈哈:
https://codepen.io/fitfingers/pen/mQEPry?editors=1100
提前感谢任何可以为我指明正确方向的人:)
【问题讨论】:
标签: html css hover anchor transition