JSFiddle - React, Tailwind, and code Playground

by Vikram Deshmukh

HTML

<p class="accordion-button-container"><button class="accordion active">Office of Student &amp; Faculty Success<span class="timestamp">⌄</span></button></p>
<div class="panel" style='display:block'>
  <div class='info'>
    <h4><a href="http://www.sjsu.edu/sfs/">www.sjsu.edu/sfs</a></h4>
    <h5>Email: [email protected]</h5>
    <h5>Phone: (408) 924-2707</h5>
    <h5>Location: CL 105</h5>
  </div>
  <div class="info">
    <h5>View Events</h5>
    <h5>Facebook: <a href='https://www.facebook.com/SJSUsuccess/' target="_blank">SJSUSuccess</a></h5>
    <h5>Twitter: <a href='https://twitter.com/sjsusuccess' target="_blank">@SJSUSuccess</a></h5>
    <h5>Instagram: <a href='https://www.instagram.com/sjsusuccess/' target="_blank">@SJSUSuccess</a></h5>
  </div>
  <hr/>
  <div class="staff">

    <div class='staff-member'>
      <img class='headshot' src='http://www.sjsu.edu/sfs/pics/Staff_0000_Andrei.jpg' />
      <div class='staff-member-info'>
        <h3>Stacy Gleixner</h3>
        <h4>AVP</h4>
        <p><a href="mailto:[email protected]"><strong>[email protected]</strong></a></p>
        <p><strong>408-924-2706</strong></p>
      </div>
    </div>

    <div class='staff-member'>
      <img class='headshot' src='http://www.sjsu.edu/sfs/pics/Staff_0000_Andrei.jpg' />
      <div class='staff-member-info'>
        <h3>Andrei Ingalla</h3>
        <h4>Academic Advising Systems Analyst</h4>
        <p><a href="mailto:[email protected]"><strong>[email protected]</strong></a></p>
        <p><strong>408-924-7046</strong></p>
      </div>
    </div>


    <div class='staff-member'>
      <img class='headshot' src='http://www.sjsu.edu/sfs/pics/Staff_0000_Andrei.jpg' />
      <div class='staff-member-info'>
        <h3>Teresa De La Cruz</h3>
        <h4>Lead Evaluator/Transfer Credit Advisor</h4>
        <p><a href="mailto:[email protected]"><strong>[email protected]</strong></a></p>
        <p><strong>408-924-8972</strong></p>
     ...

CSS

.accordion {
  background-color: #eee;
  color: #444;
  cursor: pointer;
  padding: 18px;
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  font-size: 18px;
  font-weight: bold;
  transition: 0.4s;
  border-bottom: 1px solid #ddd;
}

p.accordion-button-container {
  margin: 0px !important;
}

.timestamp {
  float: right;
  font-size: 12px;
  line-height: 1em;
  margin-top: 6px;
  color: #888;
  font-weight: normal;
}

.active,
.accordion:hover {
  background-color: #ccc;
}

.panel {
  padding: 20px;
  display: none;
  background-color: #f8f8f8;
  overflow: hidden;
}

.panel>ul {
  width: calc(100% - 300px);
}

.card {
  width: 300px;
  float: right;
}

.panel>ul,
.card {
  display: inline-block;
}

.panel {
  width: 100%;
}

.panel .info {
  display: inline-block;
  width: calc(50% - 20px);
}

.staff {
  clear: both;
  display: block;
}

.staff-member {
  display: inline-block;
  width: 320px;
  margin-right: 6px;
  margin-bottom: 6px;
  background-color: white;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

.staff .headshot {
  display: inline-block;
  float: left;
  width: 100px;
}

.staff-member-info {
  display: inline-block;
  float: right;
  box-sizing: border-box;
  padding: 5px;
  width: calc(100% - 100px);
}

.staff-member-info>* {
  margin: 0px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4em;
}

.staff-member-info>h4 {
  color: #666;
}

JavaScript

var acc = document.getElementsByClassName("accordion");
var i;

for (i = 0; i < acc.length; i++) {
  acc[i].addEventListener("click", function() {
    this.classList.toggle("active");
    var panel = this.parentElement.nextElementSibling;
    if (panel.style.display === "block") {
      panel.style.display = "none";
    } else {
      panel.style.display = "block";
    }
  });
}