<article class="container">
<!-- Внутренний Блок -->
<div class="block">
<section class="block_item block-item">
<h2 class="block-item_title">У вас уже есть аккаунт?</h2>
<button class="block-item_btn signin-btn">Войти</button>
</section>
<section class="block_item block-item">
<h2 class="block-item_title">У вас нет аккаунта?</h2>
<button class="block-item_btn signup-btn">Зарегистрироваться</button>
</section>
</div>
<!-- Блок Формы-->
<div class="form-box">
</div>
</article>
* {
box-sizing: border-box;
}
body {
font-family: sans-serif;
margin: 0;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-image: url(кб1.jpg);
background-size: 205vh;
}
/*Контейнер*/
.container {
width: 740px;
height: 50vh;
min-height: 150px;
padding: 20px 0;
position: relative;
}
.block {
height: 100%;
background-color: #fff;
opacity: 1;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
border-radius: 12px;
display: flex;
align-items: center;
}
.block_item {
text-align: center;
width: 50%;
}
.block-item_title {
font-size: 1.2rem;
font-weight: 500;
color: #000;
margin-bottom: 10px;
}
.block-item_btn {
border: none;
cursor: pointer;
padding: 10px 20px;
background-color: #f2f3f4;
color: #000;
font-size: 16px;
font-weight: 500;
border-radius: 20px;
border-radius: 20px;
border-radius: 20px;
}
/*Форма*/
.form-box {
background-color: #fff;
height: 100%;
width: 50%;
box-shadow: 0 5px 15px rgba(0,0,0,0.15);
position: absolute;
top: 0;
left: 0;
z-index: 1000;
}
.active {
left: 50%;
}
const signinbtn = document.querySelector('.signin-btn');
const signupbtn = document.querySelector('.signup-btn');
const formbox = document.querySelector('.form-box');
signupbtn.addEventListener("click", function () {
formbox.classList.add("active");
});
signinbtn.addEventListener("click", function () {
formbox.classList.remove("active");
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.