I made this background for a web page and now i need to put Some text and images into the part. But if i put anything, except tag, the ::after element go each time lower until it disappears under the page. So, it's possible to make a div that don't movve other elements in the page?
.page_part{ /* qui */
background-color: #0a0a0a;
width: 100%;
height: 100vh;
}
.page_part::before {
content: '';
position: absolute;
z-index: 0;
right: 0px;
margin-bottom: 50%;
justify-content: center;
width:50%;
height: 90vh;
background-image: linear-gradient(to top right,#FFBB86FC,#FFBB86FC, #FF3700B3);
clip-path: circle(30% at right 50%);
}
.page_part::after {
content: '';
position: absolute;
z-index: 0;
left:0px;
margin-top: 10%;
width:25%;
height: 80vh;
background-image: linear-gradient(to top right,#ff86fffc,#fdff86fc);
clip-path: circle(30% at left 50%);
}
.page_part h2{ /* setto gli h2 */
background-color: #111111;
box-shadow: 2.8px 2.8px #1d1d1d;
color: #E0E0E0;
text-align: center;
overflow-y: hidden;
width: auto;
font-weight: bold;
font-size: 3.4vh;
padding: 8px 24px;
}
<div class="page_part">
<h2>this is the page part</h2>
<div></div>
</div>
Is possible to create a div that doesn't change the positioning of the "before" element that i've created with css only?
html
<div class="page_part">
<h2>4</h2>
<div></div>
</div>
css
.page_part:nth-child(5){ /* qui */
background-color: #0a0a0a;
width: 100%;
height: 100vh;
}
.page_part:nth-child(5)::before {
content: '';
position: absolute;
z-index: 0;
right: 0px;
margin-bottom: 50%;
justify-content: center;
width:50%;
height: 90vh;
background-image: linear-gradient(to top right,#FFBB86FC,#FFBB86FC, #FF3700B3);
clip-path: circle(30% at right 50%);
}
.page_part:nth-child(5)::after {
content: '';
position: absolute;
z-index: 0;
left:0px;
margin-top: 10%;
width:25%;
height: 80vh;
background-image: linear-gradient(to top right,#ff86fffc,#fdff86fc);
clip-path: circle(30% at left 50%);
}
.page_part:nth-child(5) h2{ /* setto gli h2 */
background-color: #111111;
box-shadow: 2.8px 2.8px #1d1d1d;
color: #E0E0E0;
text-align: center;
overflow-y: hidden;
width: auto;
font-weight: bold;
font-size: 3.4vh;
padding: 8px 24px;
}```