悬停不适用于 Html 页面中的重叠 div

WCM

我正在开发用于显示视频的 Web 界面。我创建了一个有 4 列的表。然后我添加了页眉和页脚栏。页眉栏用于显示视频名称,页脚栏用于添加播放、暂停和全屏按钮。当我将鼠标悬停在相关的 td 上时,应该相应地显示这些条。现在我只为一个 td 开发,并且页眉按预期工作,但页脚没有。下面我提到了我的代码。

.wrapper{
    position: relative;
    width: 80%;
}

.videocontent{
    width: 50%;
    height: 150px;
    background-color: #78b5e9;
}

.videocontent .header {
    position: absolute;
    top: -50px;
    left: 0px;
    width: 50%;
    height: 32px;
    line-height: 32px;
    font-size: 14px;
    font-weight: bold;
    color: #cccccc;
    background: #1f1f1f;
    z-index: 1;
    display: none; 
}

.videocontent .header .text {
    float: left;
    padding-left: 10px !important;
}

.videocontent .footer{
    position: absolute;
    bottom: -50px;
    left: 0px;
    width: 50%;
    color: #ccc;
    background: #1f1f1f;
    z-index: 1;
    display: none; 
}

.videocontent:HOVER .header{
    top: 0px;
    display: block; 
}

.videocontent:HOVER .footer{
    bottom: 0px;
    display: block; 
}
<!DOCTYPE html>
<html>
<body>

    <div>
        <table class="wrapper">
            <tr>
                <td class="videocontent">
                <div id="content1" ></div>
                <div class="header" >[text]</div>
                <div class="footer" ></div>
                </td>

                <td class="videocontent"><div id="content2" ></div></td>
            </tr>
                                        
            <tr>
                <td class="videocontent"><div id="content3" ></div></td>
                <td class="videocontent"><div id="content4" ></div></td>
            </tr>
        </table>
    </div> 

</body>
</html>

Shikhar Awasthi

将位置指定videocontent为相对然后它将起作用,否则您的页脚将位于最后一行的底部,tr而页眉将位于top第一行。不管td你在哪个盘旋。

.wrapper {
  position: relative;
  width: 80%;
}

.videocontent {
  width: 50%;
  height: 150px;
  background-color: #78b5e9;
  position: relative;
}

.videocontent .header {
  position: absolute;
  top: -50px;
  left: 0px;
  width: 50%;
  height: 32px;
  line-height: 32px;
  font-size: 14px;
  font-weight: bold;
  color: #cccccc;
  background: #1f1f1f;
  z-index: 1;
  display: none;
}

.videocontent .header .text {
  float: left;
  padding-left: 10px !important;
}

.videocontent .footer {
  position: absolute;
  bottom: -50px;
  left: 0px;
  width: 50%;
  color: #ccc;
  background: #1f1f1f;
  z-index: 1;
  display: none;
}

.videocontent:HOVER .header {
  top: 0px;
  display: block;
}

.videocontent:HOVER .footer {
  bottom: 0px;
  display: block;
}
<!DOCTYPE html>
<html>

<body>

  <div>
    <table class="wrapper">
      <tr>
        <td class="videocontent">
          <div id="content1"></div>
          <div class="header">[text]</div>
          <div class="footer">[footer]</div>
        </td>

        <td class="videocontent">
          <div id="content2"></div>
        </td>
      </tr>

      <tr>
        <td class="videocontent">
          <div id="content3"></div>
        </td>
        <td class="videocontent">
          <div id="content4"></div>
        </td>
      </tr>
    </table>
  </div>

</body>

</html>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

onKeyDown事件不适用于React中的div

CSS值不适用于Angular 4中动态注入的html div元素

ng-click在ionic中不适用于div

Z-index不适用于将父DIV与其中的一个重叠

悬停不适用于导航菜单中的嵌套元素

悬停不适用于带有textarea的div元素

CSS中的悬停不适用于Electron

填充不适用于角形材质中的html标签

自动高度不适用于HTML中基于文本的div

过渡不适用于CSS中悬停的“ img”标签

宽度和高度不适用于HTML中的IMAGE

使HTML不适用于Windows 10中的Sphinx文档

CSS不适用于使用JS脚本动态添加到页面中的HTML内容

CSS不适用于放置在div中的Google广告

使用CSS在div中自动调整图像大小仅适用于宽度,不适用于高度

SVG语义缩放不适用于HTML中的SVG

悬停不适用于Javascript,CSS和HTML

jQuery单击和悬停不适用于div

sendRedirect不适用于jsp,但适用于html页面

悬停效果不适用于Chrome中的flexbox

在React中,SetInnerHTML不适用于html标签。

div悬停不适用于颜色CSS

Angular Binding 不适用于 HTML 中的选择框

当我尝试打印页面时,CSS 样式不适用于特定 div 中的跨度

Html/CSS/Javascript:弹出 onclick 不适用于第二个 div

JQuery ajaxSubmit 函数不适用于 AngularJS HTML 页面中的表单

CSS填充不适用于react js中的div

Express static 适用于 index.html 但不适用于其他静态页面

为什么 CSS 规则不适用于真正的 HTML 页面,但适用于 JSFiddle?