JSFiddle - React, Tailwind, and code Playground

by Ali Uygur

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="styles.css">
  <title>Checkbox Dropdown Örneği</title>
</head>
<body>
  <div class="dropdown-container">
<input type="text" placeholder="İsminizi girin">
<input type="password" placeholder="Şifrenizi girin">
<input type="number" placeholder="Yaşınızı girin">
<input type="date" placeholder="Doğum tarihinizi seçin">
</div>

  <div class="dropdown-container">
  
    <input type="checkbox" id="dropdown-toggle">
    <label for="dropdown-toggle" class="dropdown-label">İnput Dropdown</label>
    <div class="dropdown-content">
      <a href="#">Seçenek 1</a>
      <a href="#">Seçenek 2</a>
      <a href="#">Seçenek 3</a>
    </div>
  </div>

</body>
</html>

CSS

body {
  font-family: 'Arial', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
  background-color:grey;
  display:flex;
  flex-direction:column
}

.dropdown-container {
  position: relative;
}

#dropdown-toggle {
  display: none;
}

.dropdown-label {
  cursor: pointer;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  z-index: 1;
}

#dropdown-toggle:checked + .dropdown-label + .dropdown-content {
  display: block;
  margin-bottom:10px
}

.dropdown-content a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  width:200px
}

.dropdown-content a:hover {
  background-color: #f1f1f1;
}