如何使<'details'>下拉鼠标悬停

use*_*185 5 html css details

任何人都可以帮助我如何使用CSS将鼠标悬停的详细信息下拉

这是html代码

<details>
  <summary>Sample</summary>

Details of sample
</details>
Run Code Online (Sandbox Code Playgroud)

当鼠标悬停在它上面时,我需要一个css代码才能下载它可以帮助我吗?

Mic*_*iot 7

tepkenvannkorn的解决方案可行,但在这种情况下您不需要使用JavaScript.

HTML

<div id="summary">Sample</div>
<div id="detail">Detail of this summary</div>
Run Code Online (Sandbox Code Playgroud)

(注意摘要先于细节)

CSS

#summary:hover + #detail, #detail:hover {
  display: block;
}
#detail {
  display: none;
}
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/vSsc5/1/


Tep*_*orn 1

尝试这个:

HTML:

<div id="summary">Sample</div>
<div id="detail">Detail of theis summary</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

#summary {
    background: #666;
    width: 100px;
    color: #fff;
}

#summary:hover {
    cursor: pointer;
    color: #fff200;
}

#detail {
    width: 300px;
    height: 300px;
    background: #fff200;
    display: none;
}
Run Code Online (Sandbox Code Playgroud)

JavaScript:

$(document).ready( function() {
    $('#summary').hover( function() {
        $('#detail').toggle();
    });
});
Run Code Online (Sandbox Code Playgroud)

在这里查看我的jsfiddle