Pen Settings



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


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.


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.


                <div class="container">
  <div class="preview">
    <!-- Aside  -->
      <a aria-label="visit Frontext" href="" target="_blank" id="frontext">
        <svg width="70" height="70" viewBox="0 0 200 200" fill="none" xmlns="">
          <rect width="200" height="200" rx="100" fill="white" />
          <path d="M42 121L100 31V168L42 121Z" fill="#363535" />
          <path d="M158 121L100 31V168L158 121Z" fill="#4F4F4F" />
          <circle cx="100" cy="100" r="89.5" stroke="#fff" />
    <img src="" alt="Apple AirPods" data-zoom-img="">
      <p>Zoom for the item card. See step-by-step <a aria-label="visit Frontext" target="_blank" href="">instruction</a> .</p>
  <div class="zoom">


                @import url(;

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
.container {
  position: relative;
.preview img {
  width: 400px;
  cursor: pointer;
.zoom {
  width: 400px;
  height: 400px;
  overflow: hidden;
  position: absolute;
  top: 60px;
  right: -460px;
  pointer-events: none;
.zoom img {
  position: absolute;

p {
  font-family: 'Roboto';
  max-width: 400px;
  font-size: 13px;
p a {
  color: #000;


                const preview = document.querySelector(".preview img"),
  zoom = document.querySelector(".zoom");

const zoomHandler = (event) => {
  const zoomImg = document.querySelector(".zoom img"),
    maxX = zoomImg.offsetWidth - zoom.offsetWidth,
    maxY = zoomImg.offsetHeight - zoom.offsetHeight,
    curX = event.clientX - preview.getBoundingClientRect().left,
    curY = event.clientY - preview.getBoundingClientRect().top,
    x = curX < maxX ? curX : maxX,
    y = curY < maxY ? curY : maxY; = `left: -${x}px; top: -${y}px;`;

const zoomInit = () => {
  const zoomImg = document.createElement("img");
  zoomImg.src = preview.dataset.zoomImg;
  zoomImg.alt = preview.alt;
  document.addEventListener("mousemove", zoomHandler);

const zoomDestroy = () => {
  const zoomImg = document.querySelector(".zoom img");
  document.removeEventListener("mousemove", zoomHandler);

preview.addEventListener("mouseenter", zoomInit);
preview.addEventListener("mouseleave", zoomDestroy);