Coder Wrap provides free to use snippets Coder Wrap provides free to use snippets

Back to Accordions
Preview Source Code
Download
HTML
CSS
/**Typeo CSS Start (Note if is not need so remove)**/
@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap");
* {
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
  color: #000;
  box-sizing: border-box;
  background-color: #f5f5f5;
}
.cw-fix {
  max-width:700px;
  margin: auto;
  width: 100%;
}
/**Typeo CSS End (Note if is not need so remove)**/
.cw-tab input {
  position: absolute;
  opacity: 0;
  z-index: -1;
}

/* Accordion styles */
.cw-tabs {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 4px -2px rgba(0, 0, 0, 0.5);
}

.cw-tab {
  width: 100%;
  color: white;
  overflow: hidden;
  border-top: #ccc 1px solid;
}
.cw-tab:first-child { 
  border-top: none;
}
.cw-tab-label {
  display: flex;
  justify-content: space-between;
  padding: 1em;
  background: #2c3e50;
  font-weight: 500;
  cursor: pointer;
  font-size: 18px;
  /* Icon */
}
.cw-tab-label:hover {
  background: #1a252f;
}
.cw-tab-label::after {
  content: "❯";
  width: 1em;
  height: 1em;
  text-align: center;
  transition: all 0.35s;
}
.cw-tab-content {
  max-height: 0;
  padding: 0 1em;
  color: #2c3e50;
  background: white;
  transition: all 0.35s;
}
.cw-tab-close {
  display: flex;
  justify-content: flex-end;
  padding: 1em;
  font-size: 0.75em;
  background: #2c3e50;
  cursor: pointer;
}
.cw-tab-close:hover {
  background: #1a252f;
}

.cw-tab input:checked + .cw-tab-label {
  background: #1a252f;
}
.cw-tab input:checked + .cw-tab-label::after {
  transform: rotate(90deg);
}
.cw-tab input:checked ~ .cw-tab-content {
  max-height: 100vh;
  padding: 1em;
}

Related Snippets

Leave a comment

Your email address will not be published. Required fields are marked *