html - 用jquery在html中覆盖按钮img

标签 html css overlay

我在将 bootstrap glyphicon 图像覆盖在背景 img 上并使其作为按钮可点击时遇到问题。

我还为我想显示的其余页面使用了 jquery 模板样式,例如 flipboard 样式页面。

这是html代码,问题是最后一段代码

<body>
    <div id="st-container" class="st-container">
        <div class="st-pusher">
        <nav class="st-menu st-effect" id="menu">
           <img src="" style="height:50px;" alt="" />
            <ul id="url-list"></ul>
        </nav>

        <script id="pageTmpl" type="text/x-jquery-tmpl">
            <div class="${theClass}" style="${theStyle}">
                <div class="front">
                    <div class="outer">
                        <div class="content" style="${theContentStyleFront}">
                            <div class="inner">{{html theContentFront}}</div>
                        </div>
                    </div>
                </div>
                <div class="back">
                    <div class="outer">
                        <div class="content" style="${theContentStyleBack}">
                            <div class="inner">{{html theContentBack}}</div>
                        </div>
                    </div>
                </div>
            </div>
        </script>

这是故障代码 - 如果我删除 style="float:left"按钮是可点击的 - 那么问题是我的前页和后页没有重叠,如果添加 style="float:left"那么按钮不可点击,另一方面,img 覆盖了首页和封底。

<div id="st-trigger-effects" style="float:left;">
    <button type="button" data-effect="st-effect" class="btn btn-default">
        <span class="glyphicon glyphicon-align-justify"></span>
    </button>
</div>

我厌倦了另一种变化

<div id="st-trigger-effects" class="imgoverlay">
    <button type="button" data-effect="st-effect" class="btn btn-default">
        <span class="glyphicon glyphicon-align-justify"></span>
    </button>
</div>

css 用于正文

body{
    font-family: 'Open Sans Condensed','Arial Narrow', serif;
    background: #ddd url(../img/background.jpg) repeat top left;
    font-weight: 400;
    font-size: 15px;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-font-smoothing: antialiased;
    font-smoothing: antialiased;
    margin: 0;
    overflow: hidden;
}

和css中的overlay类

imgoverlay{
    position:absolute;
    left:0px;
    right:0px;
}

不确定我在这里做错了什么,我还在学习 css/html

最佳答案

缺少指示 imgoverlay 是 css 类的点。

.imgoverlay {
    position:absolute;
    left:0px;
    right:0px;
}

如果没有点,浏览器会查找名为 imgoverlay 的标签。 使用点,浏览器会查找任何具有 imgoverlay 类的元素。

关于html - 用jquery在html中覆盖按钮img,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21531532/

相关文章:

html - 将每个列表项设置为容器高度 (CSS) 的 50% 不起作用

javascript - 增加和减少 HTML 元素上的背景 RGBA 不透明度

FFmpeg 重新加载更改图像覆盖,同时使用复杂的过滤器/

android - WindowManager$BadTokenException : Unable to add window android. view.ViewRootImpl$W@61b864 -- 窗口类型 2010 的权限被拒绝

javascript - 覆盖导致超链接不起作用

jquery - 添加新数据后停止调整元素大小?

javascript - 如何将颜色百分比更改为 RGB

css - 可以在 flex-direction 属性上使用 CSS 动画或过渡吗?

html - div 不对齐为使用显示 : flex 的行

html - 如何创建要在网页中使用的 Logo 和图标