添加翻转仅适用于一个图像div

时间:2015-06-08 20:04:20

标签: html css

我在图像div上创建翻转,一旦翻转,图像不透明度就会下降,顶部的文字会出现。这适用于一个图像,但是当在多个图像上尝试时,不透明度不能正常工作,并且文本似乎不会出现在其他图像上。

HTML:

.worklongdiv{
    width: 100%;
    min-height: 120px;
    max-height:auto
    position: relative;
    background-color: black;  
 }  

.worklongdiv:hover img {
    opacity: 0.3;
}

.worklongdiv:hover .work-text-content-long {
    opacity: 1; 
}

.worklongdiv img {
    padding: 0;
    width: 100%;
    display: block;
    opacity: 1;
}

.worklongdiv img,
.work-text-content-long {
    -webkit-transition: opacity 0.5s ease-out;
    -moz-transition: opacity 0.5s ease-out;
    -o-transition: opacity 0.5s ease-out;
    transition: opacity 0.5s ease-out;
}

.work-text-content-long {
    height:100px;
    position: absolute;
    color: white;
    left: 0;
    top: 25%;
    right: 0%;
    left:101px;
    bottom: 0;
    font-size: 24px;
    text-align: left;
    opacity: 0;
}

CSS:

{{1}}

1 个答案:

答案 0 :(得分:1)

您在某个CSS规则中错过了;

.worklongdiv{
  width: 100%;
  min-height: 120px;
  max-height:auto;
  position: relative;
  background-color: black;
}