Как сделать так, что при нажатии на кнопку «МЕНЮ» открывался бургер ( только с помощью CSS) и aвноматически добавлял отступление для другого блока?
Как сделать так, что при нажатии на кнопку "МЕНЮ" открывался бургер (условие, что бургер только с помощью CSS) и авноматически добавлял отступление для другого блока?
(на ширине экрана 480рх)
@media (max-width: 480px) {
.logo-and-link {
display: block;
margin: 10px 0 10px 0;
}
.logo-shadow {
display: none;
}
.logo {
width: 440px;
height: 100px;
border-radius: 0px;
display: flex;
align-items: center;
justify-content: center;
}
.logo a {
margin-top: 0px;
}
.link {
display: flex;
flex-wrap: wrap;
flex-direction: row;
width: 440px;
padding: 0;
margin-top: 20px;
}
.link a {
flex: 0 1 100%;
}
.prob {
margin-left: 0;
}
.menu-link ul {
display: block;
justify-content: center;
height: 150px;
width: 440px;
box-shadow: none;
}
.menu-link ul li {
height: 40px;
border-radius: 0;
border-right: none;
margin: 10px 0 0 0;
}
.menu-link ul li a {
margin: 0 20px;
}
.menu {
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
text-transform: uppercase;
color: #ffffff;
margin-left: 35px;
}
.hamburger-menu {
background-color: #616161;
height: 45px;
margin: 0 20px;
border: 1px solid red;
}
#menu__toggle {
opacity: 0;
}
.menu__btn {
display: flex;
align-items: center;
width: 26px;
height: 16px;
cursor: pointer;
z-index: 2;
}
.menu__btn>span,
.menu__btn>span::before,
.menu__btn>span::after {
position: absolute;
width: 15px;
height: 3px;
background-color: #ffffff;
z-index: 3;
}
.menu__btn>span::before {
content: '';
top: -8px;
}
.menu__btn>span::after {
content: '';
top: 8px;
}
.menu__box {
display: block;
visibility: hidden;
left: -100%;
width: 300px;
height: 100%;
padding: 20px 0;
margin: 0 0 0px -20px;
list-style: none;
text-align: center;
}
.menu__item {
display: block;
padding: 12px 24px;
color: #333;
font-family: 'Roboto', sans-serif;
font-size: 16px;
}
.menu__item:hover {
background-color: #CFD8DC;
}
#menu__toggle:checked~.menu__btn>span {
transform: rotate(45deg);
}
#menu__toggle:checked~.menu__btn>span::before {
top: 0;
transform: rotate(0);
}
#menu__toggle:checked~.menu__btn>span::after {
top: 0;
transform: rotate(90deg);
}
#menu__toggle:checked~.menu__box {
visibility: visible;
left: 0;
}
.menu__box {
border: 2px solid red;
margin-bottom: 100px;
}
}
.block-form {
margin: 20px 20px;
display: flex;
justify-content: space-between;
width: 100%;
background-color: #cccccc;
border-radius: 5px 5px 0 0;
}
.form {
margin: 20px;
}
.form h2 {
font-size: 24px;
color: #343434;
margin-bottom: 10px;
}
.form p {
font-size: 14px;
color: #343434;
margin-bottom: 10px;
}
.first {
width: 280px;
height: 33px;
border: 2.1px solid #6f6f6f;
margin-bottom: 10px;
}
.inp {
width: 131px;
height: 33px;
border: 2.1px solid #6f6f6f;
margin-bottom: 10px;
}
.label2 {
display: flex;
justify-content: space-between;
}
.form-info {
margin: 50px;
width: 294px;
height: 192px;
background-color: rgba(255, 255, 255, 0.9);
background-image: linear-gradient(0.0deg, rgba(0, 0, 0, 0.04) 0%, rgba(255, 255, 255, 0.04) 100%);
box-shadow: 1px 2px 4px 0px rgba(1, 1, 1, 0.25);
border-radius: 5px;
}
.form-info p {
font-family: Arial;
font-size: 14px;
line-height: 20px;
font-weight: 400;
color: #333333;
margin: 15px;
}
.btn {
width: 174px;
height: 31px;
background-color: #006c86;
color: #ffffff;
font-size: 14px;
font-weight: 700;
text-transform: uppercase;
border-radius: 5px;
}
.form-info button {
margin-left: 60px;
}
@media(max-width: 480px) {
.block-form {
display: flex;
flex-wrap: wrap;
width: 480px;
height: auto;
background-color: none;
}
.form {
margin: 20px;
}
.form h2 {
font-size: 24px;
color: #343434;
margin-bottom: 10px;
}
.form p {
font-size: 14px;
color: #343434;
margin-bottom: 10px;
}
.first {
width: 280px;
height: 33px;
border: 2.1px solid #6f6f6f;
margin-bottom: 10px;
}
.inp {
width: 131px;
height: 33px;
border: 2.1px solid #6f6f6f;
margin-bottom: 10px;
}
.label2 {
display: block;
}
.form-info {
margin: 50px;
width: 294px;
height: 192px;
background-color: rgba(255, 255, 255, 0.9);
background-image: linear-gradient(0.0deg, rgba(0, 0, 0, 0.04) 0%, rgba(255, 255, 255, 0.04) 100%);
box-shadow: 1px 2px 4px 0px rgba(1, 1, 1, 0.25);
border-radius: 5px;
}
.form-info p {
font-family: Arial;
font-size: 14px;
line-height: 20px;
font-weight: 400;
color: #333333;
margin: 15px;
}
.btn {
width: 174px;
height: 31px;
background-color: #006c86;
color: #ffffff;
font-size: 14px;
font-weight: 700;
text-transform: uppercase;
border-radius: 5px;
}
.form-info button {
margin-left: 60px;
}
}
<header>
<div class=" menu-link container hamburger-menu">
<input id="menu__toggle" type="checkbox" />
<label class="menu__btn" for="menu__toggle">
<span></span><p class="menu">Меню</p>
</label>
<ul class="menu__box">
<li><a class="menu__item" href="#">Пункт меню</a></li>
<li><a class="menu__item" href="#">Длинный пункт меню</a></li>
<li><a class="menu__item" href="#">Очень длинный пункт меню</a></li>
<li><a class="menu__item" href="#">еще меню</a></li>
<li><a class="menu__item" href="#">п. меню</a></li>
</ul>
</div>
</header>
<main>
<div class="block-form container">
<div class="form">
<h2>Form</h2>
<p>Label #1</p>
<input class="first" type="text">
<div class="label2">
<div class="lab2">
<p>Label #2</p>
<input class="inp" type="text">
</div>
<div class="lab3">
<p>Label #3</p>
<input class="inp" type="text">
</div>
</div>
<div class="label2">
<div class="lab2">
<p>Label #2</p>
<input class="inp" type="text">
</div>
<div class="lab3">
<p>Label #3</p>
<input class="inp" type="text">
</div>
</div>
<button class="btn-form btn">Submit</button>
</div>
<div class="form-info">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et</p>
<p><b>Ut enim ad minim veniam, quis nostrud exercitation</b></p>
<button class="btn btn-second">More</button>
</div>
</div>
</main>