我有一个div,它在鼠标悬停时隐藏/显示。如果将位置设置为absolute,则div的背景变成透明。如果将位置设置为relative,则父div的高度会受到鼠标悬停的影响。那么如何使背景变成块状,以便内容不可见。
需要css解决方案。 给出示例->
需要css解决方案。 给出示例->
$(document).ready(
function() {
$("#hover").hover(function() {
$("#message").toggle();
});
});
#message {
border: 1px solid;
padding: 10px;
box-shadow: 5px 10px #888888;
position:absolute;
display:none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a href="#"id="hover" >Click Here</a>
<div id="message">
<b>Hidden Content</b>
<br/>This is a very large content which overlaps the content at background.<br/><br/>So the content in background should not be seen.
</div>
<div>This is another text whose content should be hidden under the popup.</div><br/>
<div>One more text added whose content is visible even if the hidden content is visible.</div>