Переворот блока на странице
Есть такой перевёрнутый блок на странице, подскажите как его можно реализовать, чтобы обрезать на половину.
* {
box-sizing: border-box;
}
.top {
padding-top: 175px;
min-height: 800px;
background: linear-gradient(90deg, #8159c6 0%, #6c7cff 100%);
}
.block {
position: absolute;
left: 0;
top: 660px;
width: 100%;
height: 153px;
background: linear-gradient(90deg, #ff9d66 0%, #ff7256 100%);
}
<section class="top">
<div class="block"></div>
</section>
Ответы (2 шт):
Автор решения: Roman Grinyov
→ Ссылка
С помошью треугольников:
.triangle-block {
position: relative;
}
.triangle-bottom {
width: 0;
height: 0;
border-top: 50px solid transparent;
border-right: 100px solid green;
}
.triangle-top {
width: 0;
height: 0;
border-left: 100px solid red;
border-bottom: 50px solid transparent;
position: absolute;
top: 0;
}
<div class="triangle-block">
<div class="triangle-bottom"></div>
<div class="triangle-top"></div>
</div>
Автор решения: Sevastopol'
→ Ссылка
Как вариант использовать clip-path. Пример:
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.top {
position: relative;
height: 100vh;
background: linear-gradient(90deg, #8159c6 0%, #6c7cff 100%);
}
.block {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: linear-gradient(90deg, #ff9d66 0%, #ff7256 100%);
-webkit-clip-path: polygon(0 100%, 100% 0, 100% 100%);
clip-path: polygon(0 100%, 100% 0, 100% 100%);
}
<section class="top">
<div class="block"></div>
</section>
