悬停时显示无效css无法正常工作

and*_*ard 0 html css block hover

我有一个div(1)在另一个div(2)之上,我希望div(2)隐藏在悬停上.我使用display:block和on hover display:none.如果你将它悬停,这将无法正常工作.它隐藏了一秒,而不是再次弹出.我的代码是:

HTML

<hgroup>
    <article>
        <div class="filter" >

        </div>
    </article>
<hgroup>
Run Code Online (Sandbox Code Playgroud)

CSS;

hgroup {
      position: relative;
      height: 100%;
      overflow: scroll;}

article {   
      background-image:url('../ad-travelfoto.png');
      width: 1000px;
      height: 578px;
      margin: 0 auto;
      margin-top: 100px;
      box-shadow: 1px 0px 7px black;
      background-size: cover;}

article:last-child{
      margin-bottom: 100px;}

.filter {
     background-color: rgba(0,0,0,0.8);
     height: 578px;
     width: 1000px;}

.filter:hover {
     display: none;}
Run Code Online (Sandbox Code Playgroud)

小智 14

这种情况正在发生,因为一旦它显示为无,你就不再在技术上徘徊在那个元素上了.

尝试使用opacity: 0;替代

  • 非常感谢你!这让我疯狂了这么久!它现在正在工作! (2认同)