html - 悬停菜单只出现一半

标签 html css

在我正在开发的网站中,我制作了一个菜单,当鼠标悬停在导航菜单项上时会出现该菜单。但是,只有一半的悬停菜单出现。

HTML:

<div class= "navn">
    <ul>
        <li>
            <a class="btn" href="about_contact.html">
                About Us              
                <div class="tooltip">
                    Contact Info, and <b>stuff</b> <!--the txt inside the hover thing-->
                </div>
            </a>
        </li> 
    </ul>
</div>

CSS:

.btn {
    /* irrelevant: some styling to make the anchor tags look nicer */
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: normal;
    text-align: center;
    white-space: nowrap;
    margin: auto;
    background-image: none;
    border: 1px solid transparent;
    border-radius: 4px;
    text-decoration: none;
    font-family: 'Lucida Sans', 'Arial', 'sans-serif';
}
.btn:hover .tooltip {
    display: block;
}
.tooltip {
    background-color: white;
    color: black;
    position: absolute;
    display: none;
    border: 1px solid black;
}

我看到的: As you can see, only upper half is appearing

为什么会这样?我能做些什么来阻止这种情况?

抱歉没有 JSFiddle

编辑:我知道我可以在 <a> 上使用标准工具提示标记,但我想在工具提示中设置格式化文本。

最佳答案

也许是你的 <div class="navn">高度不够。尝试扩展它,看看发生了什么。或者在工具提示上设置 z-index。

设置ul{ height: 60px; //for example} .我认为它对您有帮助。

关于html - 悬停菜单只出现一半,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27305678/

相关文章:

html - 在 IE8 上工作的 Safari css hack

javascript - 为具有不同 ID 名称的 div 提供内容

html - 我需要知道如何更新 bootstrap 汉堡菜单中的 UI

javascript - 使用 Nav 组件和 react-bootstrap 的 Accordion 侧边栏菜单

javascript - 通过单击鼠标切换文本以显示在某个位置

javascript - 循环图像标题不起作用

javascript - 使用 Javascript 将两个 SVG 元素合并为一个?

css - 背景颜色 : inherit doesn't work on input element on IE 8/9/10

jquery - 在 iframe 内的链接中应用 jquery

html - 图像幻灯片的行为与 CSS 不符合预期