html - CSS - 不显示弹出窗口

标签 html css

我有以下代码:

CSS

#help {
        width: 100%;
        .titletext {
                float: left;
                font-size: 150%;
        }
        .helpimage {
                float: right;
                position: relative;
        }
        .helpimage .tooltip-content {
                display: none;
                position: relative;
                bottom: 5%;
                left: 5%;
                right: 5%;
                background-color: red;
                padding: .5em;
                line-height: 1em;
        }
        .helpimage:hover .tooltip-content {
                display: block;
        }
}

HTML/MEDIAWIKI

<div id="help">
    <div class="titletext">Gene information</div>
    <div class="helpimage">[[File:Help.png]]
        <div class="tooltip-content">
            <p>Here it'll be a little explanation of this table.</p>
        </div>
    </div>
</div>

随着鼠标悬停(在图像上方),它显示Here it'll be a little explanation of this table

在图片下方,不是弹出...为什么会这样?

最佳答案

您正在嵌套您的 css 类,这在 CSS 中是不允许的,除非您可能正在使用预处理器?

我想你的 css 应该是这样的: http://jsfiddle.net/72o3x47p/2/

    #help {
            width: 100%;
    }
    .titletext {
            float: left;
            font-size: 150%;
    }
    .helpimage {
            float: right;
            position: relative;
    }
    .helpimage .tooltip-content {
            display: none;
            position: absolute; /* change from relative to absolute */
            top: 0;
            left: 0;
            background-color: red;
            padding: .5em;
            line-height: 1em;
    }
    .helpimage:hover .tooltip-content {
            display: block;
    }

关于html - CSS - 不显示弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26282455/

相关文章:

jQuery Quicksand 插件没有得到正确的位置

php - 如何自动更新网页的URI?

html - 获取导航菜单下拉菜单,使其看起来就像基本菜单项

html - CSS下拉菜单不重叠

javascript - 如何模拟输入禁用?

javascript - 如何选择 Canvas 中的特定区域?

javascript - jQuery:如何监听 DOM 变化?

javascript - Firefox 在比较操作中未检测到 rgb 颜色

html - 选择框下拉样式

html - 将内容置于元素中心,并将导航栏锁定到底部(使用 flexbox?如何使用?)