2
I made an example using the pseudo class ::after
, so you have no problem when doing the effect on the element in which your content is inside. To create this tilt I used the transform:skew
and I used flexbox to keep everything in line.
See the result in the example below:
.container {
display: flex;
position: relative;
width: 500px;
height: 300px;
background-image: url(http://unsplash.it/500/300);
background-size: cover;
overflow: hidden;
flex-direction: row-reverse;
align-items: center;
box-sizing: border-box;
padding-right: 3rem;
}
.container::after {
content: "";
position: absolute;
top: 0;
bottom: 0;
width: 100%;
background-color: rgba(0,0,0,0.5);
transform: skew(-30deg) translateX(calc(50% + 3rem));
}
.cont {
font-family: sans-serif;
color: #fff;
z-index: 99;
}
<div class="container">
<div class="cont">
<h1>Meu texto</h1>
<p>texto texto</p>
<button>BTN</button>
</div>
</div>