I'm attempting to create a card with a transform: skew(-30deg);
. My goal is to have the card split into twos color similar to this example :
I am able to create the photo when it's the entire background in play. Here is a jsfiddle example.
But when trying to add the same effect inside of a card it is having no effect. I've attempted to add the same CSS properties in the first fiddle as a pseudo-element for the class that is determining the card background. At the moment it has no effect on the card background, the card's background is still completely blue ( in the jsfiddle link below) . How can I add this effect to the card?
Here is a code snippet of my current code:
.card {
background: blue;
}
.card::after{
position: fixed;
top: 0px;
left: 0px;
width: 70%;
height: 100%;
background-color: white;
z-index: 1;
transform: skew(-30deg);
transform-origin:top;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css" rel="stylesheet"/>
<div class="row">
<div class="col">
<div class="card">
<div class="card-content black-text">
<span class="card-title">Card Title</span>
<p>I am a very simple card. I am good at containing small bits of information.
I am convenient because I require little markup to use effectively.</p>
</div>
</div>
</div>
</div>
I am expecting the same skew effect in the photo above presented inside of the card. Where there is an angled blue background with the rest being white. Here is a jsfiddle with the code for the card: https://jsfiddle.net/3cntLx5u/10/