JSFiddle - React, Tailwind, and code Playground

by velo_ninja

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>Top Slide-out Menu</title>
</head>
<body>
  <div class="menu-container">
    <input type="checkbox" id="menu-toggle">
    <label for="menu-toggle" class="menu-icon">&#9776;</label>
    <div class="menu">
      <!-- Your menu items go here -->
      <a href="#">Home</a>
      <a href="#">About</a>
      <a href="#">Services</a>
      <a href="#">Contact</a>
    </div>
  </div>

  <div class="content">
    <!-- Your main content goes here -->
    <h1>Welcome to Our Website</h1>
    <p>This is the main content of your page.</p>
  </div>
</body>
</html>

CSS

body {
  margin: 0;
  font-family: 'Arial', sans-serif;
}

.menu-container {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: #333;
  padding: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 1;
}

.menu-icon {
  font-size: 24px;
  color: #fff;
  cursor: pointer;
}

.menu {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  width: 100%;
  background-color: #333;
  padding: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 1;
}

.menu a {
  display: block;
  color: #fff;
  text-decoration: none;
  padding: 10px;
  margin: 5px 0;
  transition: background-color 0.3s;
}

.menu a:hover {
  background-color: #555;
}

#menu-toggle:checked + .menu {
  display: block;
}

.content {
  margin-top: 80px;
  padding: 20px;
}