我想linear-gradient
在图像上创建这种效果:
我试过这个代码:http ://codepen.io/anon/pen/dNZoeJ
html,
body {
width: 100%;
height: 100%;
margin: 0;
}
.bg-img {
width: 100%;
height: 100%;
background: url('http://unsplash.it/1200x800') center center no-repeat;
background-size: cover;
}
.bg-img:before {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-image: linear-gradient(to bottom right, #002f4b, #dc4225);
opacity: .6;
}
<div class="bg-img"></div>
但是我的图像是内联而不是背景,所以这不起作用。
<% review.forEach(function(review) { %>
<div class="col-md-4 col-sm-6">
<div class="thumbnail">
<div class="img">
<a href="/review/<%= review._id %>"><img src="<%= review.image %>"></a>
</div>
</div>
<div class="caption">
<a href="/review/<%= review._id %>"><h2><%= review.title %></h2></a>
</div>
<span><%= review.created.toDateString(); %></span>
<div class="relative">
<p><%- review.body.substring(0,250); %></p>
<div class="absolute"></div>
</div>
</div>
<% }) %>
有没有什么办法可以通过内联<img>
标签达到预期的效果?