JSFiddle - React, Tailwind, and code Playground

by yash009

HTML

<h2>Responsive navigation menu</h2>
<p>Resize the browser window to see the effect: When the screen is less than 600px, the navigation menu will be displayed vertically instead of horizontally.</p>

<div class="topnav">
  <a href="#">Link</a>
  <a href="#">Link</a>
  <a href="#">Link</a>
</div>

CSS

* {
  box-sizing: border-box;
}


/* Style the top navigation bar */

.topnav {
  overflow: hidden;
  background-color: #333;
}


/* Style the topnav links */

.topnav a {
  float: left;
  display: block;
  color: #f2f2f2;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
}


/* Change color on hover */

.topnav a:hover {
  background-color: #ddd;
  color: black;
}


/* On screens that are 600px wide or less, make the menu links stack on top of each other instead of next to each other */

@media screen and (max-width: 600px) {
  .topnav a {
    float: none;
    width: 100%;
  }
}