Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


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


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.


Auto Save

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.


                <div class="card">
  <div class="card-header">
    <h2 class="card-title">Card Title</h2>
  <div class="card-body">
    <div class="card-image">
      <img src="" alt="Card image">
    <p class="card-description">
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus venenatis enim at lacus feugiat, ut scelerisque est laoreet. Etiam aliquam urna non bibendum auctor. Donec euismod massa id dui tristique, vel commodo lectus rutrum. Pellentesque euismod, sem vitae pharetra bibendum, libero sapien dignissim libero, ut tincidunt urna orci vel mi.
    <button class="read-more">Read more</button>



                .card {
  width: 300px;
  border: 1px solid black;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
  overflow: hidden;
  margin: 0 auto

.card-title {
  margin: 0;
  padding: 1rem;

.card-body {
  padding: 0;

.card-image {
  width: 100%;
  height: 200px;
  overflow: hidden;

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;

.card-description {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 1rem;

.card-description.expanded {
  -webkit-line-clamp: unset;

.read-more {
  display: block;
  margin: 1rem;
  background-color: #007aff;
  border: none;
  color: white;
  cursor: pointer;
  font-weight: bold;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  transition: background-color 0.3s;

.read-more:hover {
  background-color: #0051a3;



                const cardDescription = document.querySelector('.card-description');
const readMoreButton = document.querySelector('.read-more');

readMoreButton.addEventListener('click', function() {
  readMoreButton.textContent = cardDescription.classList.contains('expanded') ? 'Read less' : 'Read more';