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="box"></div>

<div class="form">

  <label for="background-repeat">background-repeat:</label>
  <select name="background-repeat" id="background-repeat">
    <optgroup label="one value">
      <option value="repeat">repeat</option>
      <option value="no-repeat">no-repeat</option>
      <option value="repeat-x">repeat-x</option>
      <option value="repeat-y">repeat-y</option>
      <option value="space">space</option>
      <option value="round">round</option>
    </optgroup>
    <optgroup label="tow value">
      <option value="repeat repeat">repeat repeat</option>
      <option value="repeat no-repeat">repeat no-repeat</option>
      <option value="repeat space">repeat space</option>
      <option value="repeat round">repeat round</option>
      <option value="no-repeat repeat">no-repeat repeat</option>
      <option value="no-repeat no-repeat">no-repeat no-repeat</option>
      <option value="no-repeat space">no-repeat space</option>
      <option value="no-repeat round">no-repeat round</option>
      <option value="space repeat">space repeat</option>
      <option value="space no-repeat">space no-repeat</option>
      <option value="space space">space space</option>
      <option value="space round">space round</option>
      <option value="round repeat">round repeat</option>
      <option value="round no-repeat">round no-repeat</option>
      <option value="round space">round space</option>
      <option value="round round">round round</option>
    </optgroup>
  </select>

</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: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  gap: 1rem;
}

.box {
  width: min(100%, 600px);
  background-color: #fff;
  aspect-ratio: 16 / 9;
  box-shadow: 0 0 10px 1px rgb(0 0 0 / 25%);
  border: 1.625em solid rgb(220 20 20 / 38%);
}

:root {
  --repeat: repeat;
}

.box {
  background: #fff
    url("//www.w3cplus.com/sites/default/files/blogs/2022/2207/avatar.svg") left
    top / 100px 100px var(--repeat);
  overflow: hidden;
  resize: both;
}

.form {
  padding: 1rem;
  background-color: rgb(0 0 0 / 0.6);
  backdrop-filter: blur(20px);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.form select {
  padding: 0.25em 0.5em;
  font-size: inherit;
}

              
            
!

JS

              
                const rootElement = document.documentElement;
const repeatHander = document.getElementById("background-repeat");

repeatHander.addEventListener("change", (etv) => {
  rootElement.style.setProperty("--repeat", etv.target.value);
});

              
            
!
999px

Console