2016-06-30 44 views
-1

如何在悬停事件后在块内制作border-bottom如何在块内制作边框?

这个我试过用文字阴影,但似乎它不是解决

+1

您需要向我们展示你正在尝试,否则我们将无法帮助你代码.. –

+1

你能解释有点..有codepen样品或提供代码你已经尝试.. –

+0

可能重复的[放置边界里面的div和不在其边缘](http://stackoverflow.com/questions/9601357/placing-border-inside-of-div-and-not-on-其边缘) – blonfu

回答

8

中插入进去的阴影似乎是您所需要的

div { 
 
    height: 75px; 
 
    background: #c0ffee; 
 
} 
 

 
div:hover { 
 
    box-shadow: inset 0 -5px 0 red; 
 
}
<div></div>

OR

使用伪元素

div { 
 
    height: 75px; 
 
    background: #c0ffee; 
 
    position: relative; 
 
} 
 

 
div:hover::after { 
 
    content: ''; 
 
    position: absolute; 
 
    bottom: 0; 
 
    width: 100%; 
 
    height: 5px; 
 
    background: red; 
 
}
<div></div>