悬停在href上时如何显示文字 [英] How to make text appear when hover over a href

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

问题描述

我如何使文本显示在链接下?

How would I make text appear under a link?

<div class="login">
    <a href="">Login
    <p>Access your profile here</p>
    </a>
</div> 

登录在哪里触发p显示?

Where the login triggers the p to show?

我是否需要使用p或其他东西?

Do I need to use the p or something else?

推荐答案

以下样式使 p 在悬停时可见:

The following style makes the p visible on hover:

.login a p {display:none;}
.login a:hover p {display:block;}

<div class="login">
    <a href="">Login
        <p>Access your profile here</p>
    </a>
</div> 

或者如果您希望整个链接包括 p 内部在悬停时保持可见,请使用以下命令:

Or if you want the whole link including p inside stay visible together on hover use the following:

.login a p {display:none;}
.login a:hover p {display:block;}
.login a:hover {display:block;}

<div class="login">
    <a href="">Login
        <p>Access your profile here</p>
    </a>
</div> 

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

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