<div class="row">
<div class="container-a1">
<ul class="caption-style-1">
<li class="col-lg-3 col-sm-3 portfolio-item">
<img class="img-responsive" src="img/1.png" alt="">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>Amazing Caption</h1>
<p>Whatever It Is - Always Awesome</p>
</div>
</div>
</li>
<li class="col-lg-3 col-sm-3 portfolio-item">
<img class="img-responsive" src="img/1.png" alt="">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>Amazing Caption</h1>
<p>Whatever It Is - Always Awesome</p>
</div>
</div>
</li>
<li class="col-lg-3 col-sm-3 portfolio-item">
<img class="img-responsive" src="img/1.png" alt="">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>Amazing Caption</h1>
<p>Whatever It Is - Always Awesome</p>
</div>
</div>
</li>
<li class="col-lg-3 col-sm-3 portfolio-item">
<img class="img-responsive" src="img/1.png" alt="">
<div class="caption">
<div class="blur"></div>
<div class="caption-text">
<h1>Amazing Caption</h1>
<p>Whatever It Is - Always Awesome</p>
</div>
</div>
</li>
</ul>
</div>
</div>
<style>
.portfolio-item {margin:0; padding:0;}
.caption-style-1{
list-style-type: none;
margin: 0px;
padding: 0px;
}
.caption-style-1 li{
float: left;
padding: 0px;
position: relative;
overflow: hidden;
}
.caption-style-1 li:hover .caption{
opacity: 1;
}
.caption-style-1 img{
margin: 0px;
padding: 0px;
float: left;
z-index: 4;
}
.caption-style-1 .caption{
cursor: pointer;
position: absolute;
opacity: 0;
-webkit-transition:all 0.45s ease-in-out;
-moz-transition:all 0.45s ease-in-out;
-o-transition:all 0.45s ease-in-out;
-ms-transition:all 0.45s ease-in-out;
transition:all 0.45s ease-in-out;
}
.caption-style-1 .blur{
background-color: rgba(0,0,0,0.65);
height: 175px;
width: 292px;
z-index: 5;
position: absolute;
}
.caption-style-1 .caption-text h1{
text-transform: uppercase;
font-size: 24px;
}
.caption-style-1 .caption-text{
z-index: 10;
color: #fff;
position: absolute;
width: 293px;
height: 176px;
text-align: center;
}
</style>
我将悬停标题的教程转换为bootstrap。问题是网格样式组合是响应式的,我似乎无法获得响应的标题。我尝试将高度和宽度设置为100%,但这不起作用?有什么提示吗?
答案 0 :(得分:1)
Velibor Nikolic 你好。
您在div
中使用ul > li
这可能不是一个好主意
看看 link here 。
尝试使用标题执行此类操作。 对于工作示例,请查看此 Fiddle 。
这完全响应,包括图像和标题
我使用class
的引导col-xs-12
作为宽度,标题class
使用height:100%
。
我减少了一些classes
并将阴影背景添加到标题class
,不需要模糊class
。
以下是带有标题的一个图像块的示例。
<div class="col-sm-4 col-xs-12 clear-L-R">
<img src="http://lorempixel.com/640/640/nature" class="img-responsive clear-L-R" alt="">
<div class="col-xs-12 caption caption-text">
<h1>Amazing Caption</h1>
<p>Whatever It Is - Always Awesome</p>
</div>
</div>