如何在悬停标签上显示块div [英] how to display block div on hover a tag
本文介绍了如何在悬停标签上显示块div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在悬停标记时打开div标记
how to open div tag on hover a tag
我的Html代码是
<ul><li><a href="#" id="Service">Services</a></li></ul>
<div id="Services">
<h1>Hello</h1>
</div>
我的CSS代码是
#Services
{
display: none;
}
#Service:hover + #Services
{
display: block;
}
推荐答案
#Services
不是 #Service
的兄弟,因此 +
请检查此 小提琴 修改标记,使两个兄弟姐妹。
Check this fiddle for modified markup which makes the two siblings. You will need to style it accordingly.
<ul><li><a href="#" id="Service">Services</a>
<div id="Services">
<h1>Hello</h1>
</div></li></ul>
这篇关于如何在悬停标签上显示块div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文