Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <div class="card">
  <h4>Use: <code>min-width: 0</code> + <code>text-overflow: ellipsis</code> + <code>white-space: nowrap</code></h4>
  <div class="target">
    <div class="target__title">
      <strong>Flexbox Layout:</strong> Text here is very very long that it might
      get truncate if this box get resized too small
    </div>
    <div class="target__emoji">
      🎃
    </div>
  </div>
  <div class="target target--grid">
    <div class="target__title">
      <strong>Grid Layout:</strong> Text here is very very long that it might
      get truncate if this box get resized too small
    </div>
    <div class="target__emoji">
      🎃
    </div>
  </div>
</div>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  width: 100vw;
  min-height: 100vh;
  font-family: "Exo", Arial, sans-serif;
  background-color: #557;
  color: #000;
  text-shadow: 1px 1px 0 rgb(255 255 255 / 0.2),
    -1px -1px 0 rgb(255 255 255 / 0.2);
  font-wegith: 600;
  display: grid;
  padding: 1rem;
  gap: 1rem;
  place-content: center;
  justify-items: center;
}

@property --accent {
  syntax: "<color>";
  inherits: false;
  initial-value: #ffeb70;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(100%, 640px);
  height: auto;
  padding: 30px;
  margin: 10px;
  border-radius: 10px;
  z-index: 1;
  overflow: hidden;
  position: relative;
  backdrop-filter: blur(20px);
}

.card::before,
.card::after {
  content: "";
  position: absolute;
  opacity: 0.5;
}

.card::before {
  filter: blur(40px) saturate(120%) brightness(1.1);
  font-size: 440pt;
  content: "🥪";
  z-index: -1;
  animation: rotate 12s linear infinite, content 12s linear infinite;
}

.card::after {
  width: 100%;
  height: 100%;
  z-index: -2;
  content: "";
  background: var(--accent);
  animation: accent 12s linear infinite alternate;
}

@keyframes rotate {
  0% {
    transform: rotateZ(0deg);
  }
  100% {
    transform: rotateZ(-360deg);
  }
}

@keyframes accent {
  0% {
    --accent: #ffeb70;
  }
  16.666% {
    --accent: #fd560a;
  }
  33.3333% {
    --accent: #1eddfe;
  }
  50% {
    --accent: #cdf9ff;
  }
  66.6666% {
    --accent: #1296dc;
  }
  83.33333% {
    --accent: #f50d21;
  }
  100% {
    --accent: #09ad21;
  }
}

@keyframes content {
  0% {
    content: "🥪";
  }
  16.666% {
    content: "🌈";
  }
  33.3333% {
    content: "🍧";
  }
  50% {
    content: "🏡";
  }
  66.6666% {
    content: "🌃";
  }
  83.33333% {
    content: "🦜";
  }
  100% {
    content: "🔥";
  }
}

h4 {
  font-size: 1rem;
  white-space: nowrap;
  margin-bottom: 1rem;
}

h4 code {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0.125em 0.325em;
  color: #fff;
  background-color: #009688;
  border-radius: 0.12em;
}

.card strong {
  font-weight: 900;
  font-size: 1.25em;
  text-decoration-style: wavy;
  text-decoration-color: #ff006f;
  text-decoration-skip-ink: inherit;
  text-decoration-thickness: from-font;
  text-emphasis-style: inherit;
  text-decoration-line: underline;
  text-underline-offset: 0.125em;
}

.target {
  width: 100%;
  display: flex;
  align-items: center;
  border: 2px dashed #fff;
  padding: 0.5rem;
  animation: resize 12s linear infinite;
  gap: 1rem;
  border-radius: 0.25em;
}

.target__emoji {
  width: max-content;
  font-size: 2rem;
  margin-left: auto;
  flex-shrink: 0;
}

.target__title {
  padding: 5px;
}

@keyframes resize {
  0% {
    max-width: 100%;
  }

  50% {
    max-width: 50%;
  }

  100% {
    max-width: 100%;
  }
}

.target--grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  border-color: #1eddfe;
}

.target__title {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

              
            
!

JS

              
                
              
            
!
999px

Console