Я хочу создать раздел для веб-сайта, который разделен на 4 подраздела с использованием CSS Сетка. Я уже выяснил, как добавить угловые стороны к разделам, однако я не понял, как закрыть пробелы между каждым разделом. Насколько я понимаю, я не могу go превышать 100% в полигонах и не могу использовать пиксели, потому что я хочу, чтобы сетка реагировала.
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
.grid-container {
display: grid;
width: 100vw;
height: 100vh;
grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
grid-template-rows: 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
grid-template-areas:
"a a a a a a a a a a a a a a a a"
"b b b b b b b b b b b b b b b b"
"b b b b b b b b b b b b b b b b"
"b b b b b b b b b b b b b b b b"
"b b b b b b b b b b b b b b b b"
"b b b b b b b b b b b b b b b b"
"b b b b b b b b b b b b b b b b"
"b b b b b b b b b b b b b b b b"
"b b b b b b b b b b b b b b b b"
"b b b b b b b b b b b b b b b b"
"b b b b b b b b b b b b b b b b"
"c c c c d d d d e e e e f f f f"
"c c c c d d d d e e e e f f f f"
"c c c c d d d d e e e e f f f f"
"c c c c d d d d e e e e f f f f"
"c c c c d d d d e e e e f f f f";
}
.navbar {
display: flex;
justify-content: center;
align-items: center;
grid-area: a;
}
.hero-slider {
display: flex;
justify-content: center;
align-items: center;
grid-area: b;
}
.section1 {
display: flex;
justify-content: center;
align-items: center;
grid-area: c;
clip-path: polygon(
0 0,
100% 0,
95% 100%,
0 100%
);
}
.section2 {
display: flex;
justify-content: center;
align-items: center;
grid-area: d;
clip-path: polygon(
5% 0,
100% 0,
95% 100%,
0 100%
);
}
.section3 {
display: flex;
justify-content: center;
align-items: center;
grid-area: e;
clip-path: polygon(
5% 0,
100% 0,
95% 100%,
0 100%
);
}
.section4 {
display: flex;
justify-content: center;
align-items: center;
grid-area: f;
clip-path: polygon(
5% 0,
100% 0,
100% 100%,
0 100%
);
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="grid-container">
<div class="navbar" style="background-color: lightskyblue;">
Navbar
</div>
<div class="hero-slider" style="background-color: lightsteelblue;">
Heroslider
</div>
<div class="section1" style="background-color: burlywood;">
section 1
</div>
<div class="section2" style="background-color: darkgray;">
section 2
</div>
<div class="section3" style="background-color: darksalmon;">
section 3
</div>
<div class="section4" style="background-color: khaki;">
section 4
</div>
</div>
Вот код в коде ручки: https://codepen.io/LuckystrikeFTW/pen/KKpJdwo