jQuery addClass example
Change class name on click in jQuery
HTML
<div class="wrapper">
<div class="sec" id="section-1">section-1</div>
<div class="sec" id="section-2">section-2</div>
<div class="blog">
<p>Blog</p>
</div>
<h1>Заголовок</h1>
</div>
CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.wrapper {
display: flex;
flex-direction: column;
position: relative;
}
.sec {
width: 100%;
height: 400px;
}
#section-1 {
background: #ccc;
}
#section-2 {
background: #eee;
position: relative;
}
h1 {
position: absolute;
left: 50%;
transform: translateX(-50%);
bottom: 30px;
}
.blog {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 50%;
height: 50%;
border: 1px solid black;
display: flex;
justify-content: center;
align-items: center;
text-transform: uppercase;
font-size: 40px;
background: #fff;
}