JSFiddle - React, Tailwind, and code Playground

by c_vilander

HTML

<div class="wrapper">

    <div id="dropdown">
      <p>Drop Down</p>
        
</div>

CSS

.wrapper {
  margin: 0 auto;
  width: 200px;
}

#dropdown {
  position: relative;
  top: 10px;
  left: 0;
  width: 150px;
  height: 35px;
  margin: 0;
  padding: 0px 5px 2px 5px;
  border-radius: 5px;
  background: linear-gradient(to bottom, #393939 0%,#1a191a 100%);
  cursor: pointer;
}

#dropdown p {
  text-align: center;
  font-family: Raleway, 'Helvetica Neue', Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 100;
  letter-spacing: 2px;
  line-height: 38px;
  color: #fff;
}

#dropdown:hover {
  transition:  5s ease-in-out;
}

.row_one {
  position: absolute;
  top: 35px;
  left: 0;
  width: 100%;
  height: 10px;
  background: red;
  display: none;
}

JavaScript

onclick = function toggleDiv() {
    "use strict";
    var x = document.getElementById('dropdown');
    if (x.style.height === "150px") {
        x.style.height = "35px";
    } else {
        x.style.height = "150px";
        x.style.transition = "height 0.5s ease-in-out";
    }
};