如何在块级元素中实现鼠标悬停后的
我尝试使用文本阴影,但似乎不是解决方案。
border-bottom
效果?我尝试使用文本阴影,但似乎不是解决方案。
border-bottom
效果?一个内阴影盒子看起来是你需要的
div {
height: 75px;
background: #c0ffee;
}
div:hover {
box-shadow: inset 0 -5px 0 red;
}
<div></div>
或者
使用伪元素
div {
height: 75px;
background: #c0ffee;
position: relative;
}
div:hover::after {
content: '';
position: absolute;
bottom: 0;
width: 100%;
height: 5px;
background: red;
}
<div></div>