如何在其他div id悬停时使用div显示块 [英] how to use div display block in hover of other div id

查看:46
本文介绍了如何在其他div id悬停时使用div显示块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在悬停 href 标记上打开 div 标记

how to open div tag on hover href tag

这是我在hover href标记上显示div标记的代码

this is my code for display div tag on hover href tag

#Services href 标记的 id

#Services div 标记的 id

#Service:hover {
    #Services{display: block;}
}

推荐答案

您可能想要这个

HTML

<a id="service">hover Me</a>
<div id="services">Hello I'm here.</div>

CSS

#services
{
    display:none;
}

#service:hover + #services
{
    display:block;
}

在这里,我正在使用同级选择器(+).因此,请确保您的元素与上述html匹配.如果您的html结构与我的html结构不同,请不要担心还有其他选择器也可以使用.

Here I am using sibling selector (+). So make sure your elements matches with above html.If your html structure is not same as mine then don't worry there are other selector as well which you can use.

Js Fiddle演示

Js Fiddle Demo

这篇关于如何在其他div id悬停时使用div显示块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆