I have the following HTML and CSS
.container {
display: flex;
width: 100%;
height: 300px;
}
.left,
.right {
width: 50%;
height: 200px;
}
.left {
background-color: #4CAF50;
clip-path: polygon(0 0, 100% 0, 70% 100%, 0 100%);
shape-outside: polygon(0 0, 100% 0, 70% 100%, 0 100%);
}
.right {
background-color: #2196F3;
shape-outside: polygon(30% 0, 100% 0, 100% 100%, 0 100%);
clip-path: polygon(30% 0, 100% 0, 100% 100%, 0 100%);
}
<div class="container">
<div class="left"></div>
<div class="right">Lorem Ipsum asj sjas hhjks hskj hsjkas hkjas hakjsh skjh skj hsakj sakja shkjas hkjsa hskj hskjs hkjshakjsh sksah kjlash akjshskjasha kjsl</div>
</div>
It look great but I can’t figure out how to make the inside edges touch instead of being separated by a middle white section. This is what it generates right now
Additionally, I want the text to wrap inside the dive and not break out. Thanks in advance for any help.
2
Answers
Since the
div
‘s are already clipped, all it takes is to nudge them to the side, for example with a negative margin, in your case-15%
.This would make the combined width 85% of the container. To compensate I use an inner container wider by ~15%. This may effect the angel of the diagonals.
If I understood you correctly, perhaps this example can help you:
In this example, I take into account that text can be in both blocks. By changing the CSS variable (
--skew
), you can adjust the skew you want.