【发布时间】:2016-09-21 20:21:53
【问题描述】:
Click here to see Screenshot. 我想创建一个带有标题和覆盖悬停效果的响应式图像。
注意事项:
- 在所有设备中,翻转和推出时,字幕位置将保持不变。
- 鼠标悬停时,字幕背景将以 60% 的不透明度覆盖整个图像。
- 为了对齐标题和标题背景,我需要每隔 10px-15px 编写媒体查询。
- 请看附件截图。
.container-home{
width: 100%;
background: #e3e3e3;
padding-bottom: 40px;
margin-bottom: -20px;
}
.caption-style-2{
}
.caption-style-2 .img-home{
overflow: hidden;
margin: 2% 0;
}
.caption-style-2 .img-home:hover .caption{
opacity: 1;
transform: translateY(-230px);
-webkit-transform:translateY(-230px);
-moz-transform:translateY(-230px);
-ms-transform:translateY(-230px);
-o-transform:translateY(-230px);
}
.caption-style-2 img{
margin: 0px;
padding: 0px;
float: left;
z-index: 4;
width: 100%;
}
.caption-style-2 .caption{
cursor: pointer;
position: absolute;
opacity: .8;
top:70px;
-webkit-transition:all 0.15s ease-in-out;
-moz-transition:all 0.15s ease-in-out;
-o-transition:all 0.15s ease-in-out;
-ms-transition:all 0.15s ease-in-out;
transition:all 0.15s ease-in-out;
}
.caption-style-2 .blur{
background-color: rgba(0,0,0,0.7);
opacity: 0.7;
height: 400px;
width: 435px;
top: 150px;
z-index: 5;
position: absolute;
}
.caption-style-2 .caption-text h1{
font-size: 18px;
}
.caption-style-2 .caption-text{
z-index: 10;
color: #fff;
position: absolute;
width: 300px;
height: 220px;
left: 15px;
top:128px;
opacity: 1;
}
.caption-style-2{
padding-right: 0;
padding-left: 0;
margin:auto;
}
.caption-style-2 .col-md-4, .caption-style-2 .col-sm-6, .caption-style-2 .col-xs-6{
padding-right: 0;
padding-left: 0;
}
.caption-style-2 .margin-a {
margin-left: 2%;
margin-right: 2%;
}
.caption-style-2 .margin-b {
margin-left: 2%;
margin-right: 2%;
}
.caption-style-2 .col-xs-6 {
width: 48%;
}
.caption-style-2 .sky-blue-bg {
background: #0086b8;
}
<div class="row caption-style-2">
<div class="col-md-4 col-sm-6 col-xs-6 img-home">
<img src="images/image_1.png" alt="">
<div class="caption">
<div class="blur sky-blue-bg"></div>
<div class="caption-text">
<h1>Caption 1</h1>
</div>
</div>
</div>
</div>
【问题讨论】:
-
Stackoverflow 不是代码编写服务。您至少必须尝试自己编写代码。如果您有任何特殊问题,那么您可以返回您的代码,然后提出更具体的问题。
-
另外,没有附加截图..
-
添加截图、HTML 和 CSS
标签: html css twitter-bootstrap-3 responsive-design responsive