Apply CSS to a div [duplicate]

0

Hello everyone, I have a question about what I can do with CSS that my div looks like that, biased in half, greetings and I await your comments, have an excellent day.

    
asked by WTFChamp 27.09.2017 в 18:42
source

1 answer

1

You could use a pseudo-element and apply a transformation.

This would be a quick example:

div {
    position: relative;
    width: 400px;
    height: 240px;
    background: purple;
    overflow: hidden;
}

div:before {
    position: absolute;
    top: 0;
    right: -20%;
    bottom: 0;
    left: 50%;
    background: rgba(255,255,255,0.5);
    content: '';
    transform: skew(-30deg);
}
<div></div>
    
answered by 27.09.2017 / 18:56
source