Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将文本悬停在div上,图像在其中_Javascript_Css - Fatal编程技术网

Javascript 将文本悬停在div上,图像在其中

Javascript 将文本悬停在div上,图像在其中,javascript,css,Javascript,Css,我有以下代码: <!DOCTYPE html> <html lang="pl"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <link href="assets/css/bootstrap.min.css" rel="stylesheet"> &l

我有以下代码:

<!DOCTYPE html>
<html lang="pl">
   <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <link href="assets/css/bootstrap.min.css" rel="stylesheet">
      <script src="assets/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class="col-xs-12 col-sm-4 col-md-3 col-lg-3 profil_zd">
         <div class="profil_zd_1"><a href="pl/Zdjecie/12"><img src="assets/uploads/posts/t4G9Q23vJrXOfBkHEYx0MbsycWd6gwo5Vjla7UnLKApZS18qDINTimPhuReC.jpg" class="img-responsive center profil_zd_2 profil_zd_2XXX"></a></div>
         <div class="middleImage">
            <div class="post-info">254</div>
            <div class="text">name and surname<img src="assets/images/ikon22.png" class="deleteMyAccount " id=""></div>
         </div>
      </div>
      <style>
         .middleImage {
         transition: .5s ease;
         opacity: 0;
         position: absolute;
         top: 50%;
         left: 50%;
         transform: translate(-50%, -50%);
         -ms-transform: translate(-50%, -50%);
         text-align: center;
         }
         .profil_zd_1:hover .profil_zd_2XXX {
         opacity: 0.5;
         }
         .profil_zd_1:hover .middleImage {
         opacity: 1;
         }
         .profil_zd_2 {
         border-radius: 25px;
         }
         style.css:135.center {
         margin: 0 auto;
         }
      </style>
   </body>
</html>

254
姓名
中影{
过渡:放松;
不透明度:0;
位置:绝对位置;
最高:50%;
左:50%;
转换:翻译(-50%,-50%);
-ms转换:翻译(-50%,-50%);
文本对齐:居中;
}
.profil_zd_1:hover.profil_zd_2XXX{
不透明度:0.5;
}
.profil_zd_1:hover.middleImage{
不透明度:1;
}
.profil_zd_2{
边界半径:25px;
}
style.css:135.center{
保证金:0自动;
}
Prview: 我需要的是:


我需要悬停效果(将鼠标悬停在照片上后),必须显示带有声音和文本数量的图片(用于示例)。有人知道如何修复我的代码吗?

对于图像上的文本覆盖,您可以按照以下简单过程操作:

.outer{
背景色:#000000;
宽度:90vw;
填充:100px;
}
.集装箱{
位置:相对位置;
宽度:50%;
边框:5px纯白;
}
.形象{
显示:块;
宽度:100%;
高度:自动;
}
.覆盖{
位置:绝对位置;
排名:0;
底部:0;
左:0;
右:0;
身高:100%;
宽度:100%;
不透明度:0;
过渡:放松;
背景色:#000000;
}
.container:悬停。覆盖{
不透明度:0.7;
}
.文本{
颜色:白色;
字体大小:20px;
位置:绝对位置;
最高:50%;
左:50%;
-webkit转换:翻译(-50%,-50%);
-ms转换:翻译(-50%,-50%);
转换:翻译(-50%,-50%);
文本对齐:居中;
}

你好,世界
请签出此答案