css - 元素层阻止鼠标悬停以显示标题

标签 css

对不起标题,暂时想不出更好的描述。

情况:将鼠标悬停在进度条上以显示标题。灰色与绿色混合的小区域(在我的真实情况下更大)没有显示标题。看起来数字是进度条前面的一层。

enter image description here

http://jsfiddle.net/w6fpszkx/

<div class="col-md-4">
    <div class="panel panel-default">
        <div class="panel-heading text-center">Title</div>
        <div class="panel-body" style="padding: 0px 15px 15px 15px;">
            <p class="text-center" style="font-size: 110px; line-height: 1;">82<span style="font-size: 23px;">%</span></p>
            <div class="progress">
                <div title="" data-html="true" class="progress-bar progress-bar-success" style="width: 82%" data-original-title="ON TIME<br><span class='label label-success' style='display: inline-block; width: 100%; margin-bottom: 5px;'>9 (82%)</span>">
                    <span>9 (82%)</span>
                </div>
                <div title="" data-html="true" class="progress-bar progress-bar-danger" style="width: 18%" data-original-title="EXPIRED<br><span class='label label-danger' style='display: inline-block; width: 100%; margin-bottom: 5px;'>2 (18%)</span>">
                    <span>2 (18%)</span>
                </div>
            </div>
        </div>
    </div>
</div>

是否可以将顶部和底部的灰色区域从“82”数字减少到数字本身的顶部和底部限制?谢谢。

最佳答案

是的。您必须更好地调整元素的 line-height

.text-center {
    line-height: 0.75;
    }

(我删除了您在 html 中作为在线样式添加的值“1”)

JSFIDDLE

已编辑:但要确保您的工具提示始终显示,只需添加:

.progress {
    position:relative;
    z-index:1;
}

所以你的酒吧将永远超过这个数字:

updated FIDDLE

关于css - 元素层阻止鼠标悬停以显示标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33543518/

相关文章:

css - GWT 设计一个按钮

javascript - HTML 按钮不使用 Javascript 隐藏

javascript - 和弦和歌词格式问题

css - 使用 Less 时在 CSS 值中斜线 (`/` )(例如在 `font` 简写中)

javascript - 如何使用 D3 更改(和过渡)DIV 高度?

javascript - 防止文本选择退出 div

html - 格式化 html 表格列中的文本?

html - 位置 :fixed on my nav bar breaks scrolling

css - 如何根据屏幕大小更改背景图像,可能使用 Bootstrap

php - 属性内的 If else 语句和 If else 语句内的属性