Одна из идей - рассмотреть большой элемент треугольной angular формы, где ширина / высота задаются с учетом угла, который вы хотите использовать.
Вот пример для иллюстрации:
.container {
display: flex;
height: 80vh; /* dynamic height */
background:blue;
overflow:hidden; /* hide the overflow of the big shape */
color:#fff;
font-size:25px;
}
.container > * {
outline: 1px dashed black;
padding: 4rem;
width: 50%;
margin:0;
box-sizing:border-box;
}
.container > *:last-child {
background:orange;
position: relative;
}
.container > *:last-child::before {
content:"";
position:absolute;
right:calc(100% - 0.5px); /* a litte less than 100% to avoid a gap issue */
top:0;
height:130vh; /* a big height, 100vh should be enough but a bit bigger won't hurt */
width:calc(130vh * 0.249328); /* height x tan(14deg) */
background:inherit;
clip-path:polygon(0 100%,100% 100%,100% 0); /* triangle shape */
opacity:0.9; /* to illustrate the shape */
}
body {
margin:0;
}
<section class="container">
<p class="left">
Some text spanning multiple lines
</p>
<p class="right">
Some text spanning multiple lines
</p>
</section>
Другая идея с тем же трюком, но с использованием box-shadow
и меньше кода:
.container {
display: flex;
height: 80vh; /* dynamic height */
background:blue;
overflow:hidden; /* hide the overflow of the big shape */
color:#fff;
font-size:25px;
}
.container > * {
outline: 1px dashed black;
padding: 4rem;
width: 50%;
margin:0;
}
.container > *:last-child {
background:orange;
box-shadow:0 0 0 100vw orange; /* a very big box shadow*/
clip-path:polygon(0 0,100% 0, 100% 150vh,calc(-0.249328 * 150vh) 150vh);
/* the clip-path will cut a shape like below
(0 0) _______ (100% 0)
/ |
/ | <--- the real content end here, below is overflowing
(X 150vh) /_________| (100% 150vh)
X = 0 - tan(14deg)*150vh
*/
}
body {
margin:0;
}
<section class="container">
<p class="left">
Some text spanning multiple lines
</p>
<p class="right">
Some text spanning multiple lines
</p>
</section>
ОБНОВЛЕНИЕ
Первый код без clip-path
для лучшей поддержки:
.container {
display: flex;
height: 80vh; /* dynamic height */
background:blue;
overflow:hidden; /* hide the overflow of the big shape */
color:#fff;
font-size:25px;
}
.container > * {
outline: 1px dashed black;
padding: 4rem;
width: 50%;
margin:0;
box-sizing:border-box;
}
.container > *:last-child {
background:orange;
position: relative;
}
.container > *:last-child::before {
content:"";
position:absolute;
right:calc(100% - 0.5px); /* a litte less than 100% to avoid a gap issue */
top:0;
height:130vh; /* a big height, 100vh should be enough but a bit bigger won't hurt */
width:calc(130vh * 0.249328); /* height x tan(14deg) */
background:linear-gradient(to bottom right,transparent 49.5%,orange 50%); /* triangle shape */
opacity:0.9; /* to illustrate the shape */
}
body {
margin:0;
}
<section class="container">
<p class="left">
Some text spanning multiple lines
</p>
<p class="right">
Some text spanning multiple lines
</p>
</section>