Reputation: 325
Hey to all knower of CSS3, I have a little problem with background-image, I need to get a result like this image. but I came across a problem with the background like here http://bagrattam.com/stackoverflow/bg-skew/bg.html.
I'll be very thankful if you help me in this problem.
HTML:
<header>
<div class="container">
<h6>Production</h6>
<h1>This is the heading</h1>
<h5>This is the subheading</h5>
</div>
<div class="angleLayer">
<div class="blogProfile">
<figure class="imgFrame">
<img src="" width="66" height="66" alt="">
</figure>
<div class="profileInfo">
<div class="name">Name Surname</div>
<time class="date" datetime="2015-04-28">April 08, 2005</time>
</div>
</div>
</div>
</header>
CSS:
header {
background-image: url("http://bagrattam.com/website/images/other/paint.png");
background-repeat: no-repeat;
background-size: cover;
text-align: center;
position: relative;
}
header:after {
background: inherit;
backface-visibility: hidden;
transform: skewY(-12deg);
transform-origin: 100% 50% 0;
content: " ";
display: block;
height: 100%;
position: absolute;
left: 0;
bottom: 0;
right: 0;
z-index: -1;
}
.angleLayer {
transform: skewY(-12deg);
transform-origin: 100% 0 0;
-webkit-backface-visibility: hidden;
z-index: 2;
position: relative;
}
.blogProfile {
transform: skewY(12deg);
-webkit-backface-visibility: hidden;
position: absolute;
top: -33px;
left: 0;
right: 0;
}
Upvotes: 0
Views: 412
Reputation: 116
Try using clip-path
property
header {
background: url("http://bagrattam.com/website/images/other/paint.png") no-repeat;
background-size: cover;
text-align: center;
height: 351px;
position: relative;
}
header:after {
-webkit-clip-path: polygon(0% 100%, 100% 100%, 101% 62%);
clip-path: polygon(0% 100%, 100% 100%, 101% 62%);
background: #fff;
content: " ";
display: block;
height: 100%;
position: absolute;
left: 0;
bottom: 0;
right: 0;
}
https://jsfiddle.net/riju2142/p58c6ybv/
Good Luck
Upvotes: 1