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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <!doctype html>
<html lang="de">
<head>
 <title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>
<div class="container">
  <div class="banner_border">
    <div class="banner_content">
      <div class="banner_content_main">
        <p>TITLE</p>
        <button class="expand-button">OPEN</button>  
        <div class="special-text">
        <p>
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed dot eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor. Reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt inre culpa qui officia deserunt mollit anim id est laborum.
       </p>
       <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed dot eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor. Reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt inre culpa qui officia deserunt mollit anim id est laborum.
      </p>
      </div>
      <p>TITLE</p>
      <button class="expand-button">OPEN</button>
      <div class="special-text">
      <p>
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed dot eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor. Reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt inre culpa qui officia deserunt mollit anim id est laborum.
     </p>
     <p>
      Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed dot eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor. Reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt inre culpa qui officia deserunt mollit anim id est laborum.
    </p>   
    </div>
   </div>
  </div>
 </div>
</div>
</body>
</html>



              
            
!

CSS

              
                .expand-button {
	 cursor: pointer;
	 display: block;
	 width: 50%;
	 margin-top: 1rem;
	 margin-left: auto;
	 margin-right: auto;
	 border: 4px solid #005858;
	 border-radius: 3px;
	 background-color: darkcyan;
	 color: white;
	 font-size: 1rem;
	 padding: 0.5rem;
}
 .expand-button:hover, .expand-button:active, .expand-button:focus {
	 background-color: #007272;
}
 .special-text {
	 position: relative;
	 max-height: 50px; /*change height of fading text here*/
	 overflow: hidden;
	 transition: max-height .7s ease; /*change speed of expand/collapse here*/
}
 .special-text.-expanded {
	 max-height: 100vh;
}
 .special-text:not(.-expanded)::after {
	 content: '';
	 position: absolute;
	 top: 0;
	 bottom: 0;
	 left: 0;
	 right: 0;
	 background: linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
}
 
              
            
!

JS

              
                $(".expand-button").on("click",function(){
   $plus=$(this).next();
  $plus.toggleClass("-expanded");
  
 if ($plus.hasClass("-expanded")) {
    $(this).html("CLOSE");
  } else {
    $(this).html("OPEN");
  }
 });

              
            
!
999px

Console