In fact, the button for the hamburger menu can be made in different ways.
Check out my example. Now your tag <label>
has a height and width, and this means that you can now adjust the height of the lines - <span>
.
And now, you can see the background color - background: red
.
Also, I added a rule right: 50px
for label
. Now you can adjust the padding.
I marked all the edits in css.
* {
margin: 0;
padding: 0;
}
input {
display: none;
}
.wrapper {
display: flex;
align-items: center;
justify-content: flex-end;
position: relative;
width: 100%;
height: 100px;
background: lightblue;
}
span {
/*position: absolute;*/ /*remove*/
z-index: 1;
/*width: 70px;*/ /*remove*/
width: 100%; /*add*/
height: 5px;
background: #000;
display: block;
}
span:nth-child(1) {
top: 0px;
}
span:nth-child(2) {
top: 30px;
}
span:nth-child(3) {
top: 60px;
}
label {
background: red;
position: relative;
/*display: block;*/ /*remove*/
display: flex; /*add*/
flex-direction: column; /*add*/
justify-content: space-between; /*add*/
width: 70px; /*add*/
height: 50px; /*add*/
right: 50px; /*add*/
}
<div class="wrapper">
<input type="checkbox" id="click">
<label for="click">
<span></span>
<span></span>
<span></span>
</label>
</div>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…