Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="wrapper">

  <h1>Accordion Menu + Tooltip</h1>

  <div class="wrap-1">
    <input type="radio" id="tab-1" name="tabs">
    <label for="tab-1"><div>tab one</div><div class="cross"></div></label>
    <div class="content">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia autem quasi inventore unde nobis voluptatibus illum quae rerum laudantium minima, excepturi quis maiores. Eaque quae, nam delectus explicabo, deserunt ipsum!</div>
  </div>

  <div class="wrap-2">
    <input type="radio" id="tab-2" name="tabs">
    <label for="tab-2"><div>tab two</div><div class="cross"></div></label>
    <div class="content">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Mollitia autem quasi inventore unde nobis voluptatibus illum quae rerum laudantium minima, excepturi quis maiores. Eaque quae, nam delectus <span class="tip" data-tip="Eaque quae, nam delectus explicabo, deserunt ipsum!">explicabo</span>,
      deserunt ipsum! Lorem ipsum dolor sit amet, consectetur adipisicing elit. <span class="tip" data-tip="Lorem ipsum dolor sit amet, consectetur adipisicing elit.">Mollitia</span> autem quasi inventore unde nobis voluptatibus illum quae rerum laudantium
      minima, excepturi quis maiores. Eaque quae, nam delectus explicabo, <span class="tip" data-tip="Lorem ipsum dolor sit amet.">deserunt</span> ipsum!</div>
  </div>

  <div class="wrap-3">
    <input type="radio" id="tab-3" name="tabs">
    <label for="tab-3"><div>tab three</div><div class="cross"></div></label>
    <div class="questions">
      <div class="question-wrap">
        <input type="radio" id="question-1" name="question">
        <label for="question-1"><div>question one</div> <div class="cross"></div></label>
        <div class="content">
          Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsam atque, soluta doloribus distinctio saepe labore voluptates facere illum alias perferendis praesentium quia vel accusamus incidunt corporis veniam sapiente. Voluptate, quasi.
        </div>
      </div>
      <div class="question-wrap">
        <input type="radio" id="question-2" name="question">
        <label for="question-2"><div>question two</div> <div class="cross"></div></label>
        <div class="content">
          Ipsam atque, soluta doloribus distinctio saepe labore voluptates facere illum alias perferendis praesentium quia vel accusamus incidunt corporis veniam sapiente. Voluptate, quasi.
        </div>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                * {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-family: 'Space Mono', monospace;
    color: #3E474F;
}

body {
  overflow: hidden;
}

.wrapper {
    max-width: 600px;
    width: 100%;
    margin: 10vh auto;
}

h1 {
    font-size: 2em;
    margin-bottom: 20px;
    text-align:center;
}

input {
    display: none;
}

label {
    display: flex;
    width: 100%;
    height: 50px;
    cursor: pointer;
    border: 3px solid #3E474F;
    user-select: none;
}

label div:first-child {
    width: 100%;
    line-height: 45px;
    margin-left: 10px;
    font-size: 1.2em;
}

.cross{
    margin-right:15px;
    margin-top:3px;
}

.cross:before,.cross:after {
    content: '';
    border-top: 2px solid #3E474F;
    width: 15px;
    display: block;
    margin-top: 18px;
    transition: 0.3s;
}

.cross:after {
    transform: rotate(90deg);
    margin-top: -2px;
}

.content {
    box-sizing: border-box;
    font-size: 0.9em;
    margin: 10px 10px;
    max-height: 0;
    overflow: hidden;
    transition: max-height, .5s;
}

input:checked ~ .content {
    max-height: 400px;
    transition: max-height, 1s;
}

input:checked ~ label .cross:before {
    transform: rotate(180deg);
}

input:checked ~ label .cross:after {
    transform: rotate(0deg);
}

.questions{
    margin-top:20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height, .5s;
}

.questions label{
    border:none;
    box-shadow: none;
    margin:0;
}

input:checked ~ .questions {
    max-height: 400px;
    border-bottom:2px solid #3E474F;
    transition: 1s;
}

/*----------tool-tip------------*/

.tip {
    color: #f03768;
    cursor: help;
    position: relative;
    overflow: visible;
    font-family: monospace;
    font-size: 1.3em;
}

.tip:before,
.tip:after {
    position: absolute;
    opacity: 0;
    z-index: -100;    
    transform: translateY(-30%);
    transition: .4s;
}

.tip:before {
    content: '';
    border-style: solid;
    border-width: 0.8em 0.5em 0 0.5em;
    border-color: #3E474F transparent transparent transparent;
    transform: translateY(-200%);
    bottom:90%;
    left:50%;
}

.tip:after {
    content: attr(data-tip);
    background: #3E474F;
    color: white;
    width: 150px;
    padding: 10px;
    font-size: 0.8em;
    bottom: 150%;
    left: -50%;
}

.tip:hover:before,
.tip:hover:after {
    opacity: 1;
    z-index: 100;
    transform: scaleY(1);
}

              
            
!

JS

              
                // no JS required
              
            
!
999px

Console