-2
Good afternoon ! How can I make the container hide ul when the checkbox is checked? or how I can do it in another way that is simple, only with CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
list-style: none;
}
.container {
width: 300px;
height: 1px;
position: absolute;
top: 30%;
left: 40%;
text-align: center;
border: solid tomato 1px;
cursor: pointer;
transition: .3s;
}
.container ul {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
border: lime solid 1px;
}
#check:checked ~ .container {
height: 100px;
}
<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Document</title>
</head>
<body><input type="checkbox" id="check">
<label for="check" class="flex">
<h4>Click</h4>
</label>
<div class="container">
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
</body>
</html>
Ever tried to put a
overflow: hidden
in the.container
? See the documentation.– fernandosavio
worked out bro! vlw
– Cristian Mota