I have a problem with adding an irregular shape before div.
I need to get effect as in this image:

But I need to get this effect for whole content div. Not only left or bottom. I tried to adapt css's arrow made with border but it does not give me the correct effect.
Is it better to use the borders with combination of transparent color and ::before, ::after pseudo elements, or background-clip property.
My HTML structure
.wrapper::before {
  display: block;
  height: 0px;
  width: 0px;
  border-left: 5px solid transparent;
  border-right: 650px solid transparent;
  border-bottom: 50px solid black;
}
.content {
  background-color: #f2f2f2;
  box-sizing: border-box;
  color: #000;
  text-transform: uppercase;
}
<div class="wrapper">
  <div class="content">
    Content
  </div>
</div>
Is there a way to combine  ::after and ::before pseudoelements to add this effect to whole div?
The ::before selector inserts something before the content of each selected element(s). Use the content property to specify the content to insert. Use the ::after selector to insert something after the content.
::before. In CSS, ::before creates a pseudo-element that is the first child of the selected element. It is often used to add cosmetic content to an element with the content property.
A CSS pseudo-element is a keyword added to a selector that lets you style a specific part of the selected element(s). For example, ::first-line can be used to change the font of the first line of a paragraph. /* The first line of every <p> element. */ p::first-line { color: blue; text-transform: uppercase; }
Due to the irregular shape, this is going to be tricky, maybe border-image would be an easier solution. If the blue background may be based on a rectangular shape, you can easily do it with a single pseudo-element using skew and rotation transforms, e.g.
.wrapper {
  padding: 50px;
  position: relative;
}
.content {
    background-color: #f2f2f2;
    box-sizing: border-box;
    color: #000;
    text-transform: uppercase;
    width: 300px;
    height: 200px;
    position: relative;
    z-index: 3;
    text-align: center;
    line-height: 200px;
}
.wrapper::before {
  content: '';
  display: block;
  background: rgb(145,205,239);
  width: 330px;
  height: 230px;
  position: absolute;
  z-index: 1;
  margin: -15px;
  transform: rotate(-1deg) skew(-5deg, -3deg);
}
<div class="wrapper">
    <div class="content">
CONTENT
    </div>
</div>
I have example for your layout, you can custom it and apply your code.
.content {
  background-color: #f2f2f2;
  box-sizing: border-box;
  color: #000;
  text-transform: uppercase;
  width: 100%;
  height: 100%;
  transform: skew(3deg, 5deg);
  -webkit-transform: skew(3deg, 5deg);
  -moz-transform: skew(3deg, 5deg);
  -o-transform: skew(3deg, 5deg);
  -ms-transform: skew(3deg, 5deg);
  position: relative;  
}
.wrapper {
  width: 400px;
  height: 222px;
  margin: 50px;
  padding: 25px 10px;
  background-color: blue;
  transform: skew(-3deg, -5deg);
  -webkit-transform: skew(-3deg, -5deg);
  -moz-transform: skew(-3deg, -5deg);
  -o-transform: skew(-3deg, -5deg);
  -ms-transform: skew(-3deg, -5deg);
  box-sizing: border-box;
}
.content-text {
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
  -moz-transform: translate(-50%, -50%);
  -o-transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
}
<!DOCTYPE html>
<html lang="">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Title Page</title>
  </head>
  <body>
    <div class="wrapper">
      <div class="content">
        <p class="content-text">Content</p>
      </div>
    </div>
  </body>
</html>
<div class="wrapper"> is not required for this task.transform: scale(1.1, 1.18) skew(-4deg,-1.5deg)..content {
  background-color: #f2f2f2;
  color: #000;
  font-family:  Impact, "Trebuchet MS", sans-serif;
  text-transform: uppercase;
  float: left;
  margin: 40px;
  position: relative;
  width: 360px;
  height: 180px;
  line-height: 180px;
  text-align: center;
}
.content::before {
  content: '';
  background: #91cdef;
  display: block;
  width: 360px;
  height: 180px;
  position: absolute;
  transform: scale(1.1, 1.18) skew(-4deg,-1.5deg);
  z-index: -1;
}
img {
  float: left;
  margin: 19px;
}  
<div class="content">Content</div>
<div class="content">Content</div>
<div class="content">Content</div>
<div class="content">Content</div>
<img src="http://i.stack.imgur.com/9vJ92.png" alt="">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With