What is wrong with position preference <h1/>? You can compensate for the position by adding indentation to .slider.
.slider {
position: relative;
padding-top: 10px;
}
h1 {
position: absolute;
top: -10px;
}
overflow: hidden; .slider, . overflow: visible;, .
body {
background: yellow;
padding: 50px;
}
.slider {
width: 100%;
height: 650px;
margin-top: 40px;
background: orange;
box-shadow: 0 0 78px 11px #F3286B;
position: relative;
padding-top: 10px
}
h1,
h2 {
text-transform: uppercase;
color: red;
}
h1 {
font-size: 11vw;
position: absolute;
top: -10px;
}
h2 {
font-size: 7vw;
}
<body>
<div class="slider">
<h1>
Happy Fruit
</h1>
<h2>
HELLO WORLD
</h2>
</div>
</body>
Hide result