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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <div class="container"> 
  <div class="fixed"> </div>

<h1 class="title">触发父元素生成层叠上下文的方式: 
    <select id="select">
        <option value="g-empty">none</option>
        <option value="g-absolute">z-index 值不为 "auto"的 绝对/相对定位</option>
        <option value="g-flex">一个 z-index 值不为 "auto"的 flex 项目 (flex item)</option>
        <option value="g-opacity">opacity 属性值小于 1 的元素</option>
        <option value="g-transform">transform 属性值不为 "none"的元素</option>
        <option value="g-blend">mix-blend-mode 属性值不为 "normal"的元素</option>
        <option value="g-filter">filter值不为“none”的元素</option>
        <option value="g-perspective">perspective值不为“none”的元素</option>
        <option value="g-isolation">isolation 属性被设置为 "isolate"的元素</option>
        <option value="g-fixed">position: fixed</option>
        <option value="g-willChange">在 will-change 中指定了任意 CSS 属性</option>
        <option value="g-scrolling">-webkit-overflow-scrolling 属性被设置 "touch"的元素</option>
        <option value="g-preserve3d">设置了 transform-style: preserve-3d 的元素</option>

              h1 {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 999;
    height: 10vh;
    line-height: 10vh;
    color: #333;
    font-size: 1.5vw;

select {
    height: 10vh;
    line-height: 10vh;
    font-size: 1vw;
    outline: none;
    border: 1px solid #333;

.container {
    height: 10vw;
    // transform: translate3d(5vw, 5vw, 0);
    // will-change: transform;
    background: rgba(255, 100, 100, .8);

.fixed {
    position: fixed;
    top: 1vw;
    left: 1vw;
    right: 1vw;
    bottom: 1vw;
    background: rgba(100, 100, 255, .8);

.g-absolute {
    position: absolute;
    z-index: 10;

.g-flex {
    display: flex;
    z-index: 10;

.g-opacity {
    opacity: .5;

.g-transform {
    transform: translate3d(0, 0, 0);
    // transform: scale(1);

.g-blend {
    mix-blend-mode: screen;

.g-filter {
    filter: blur(5px);

.g-perspective {
    perspective: 1000px;

    isolation: isolate;

.g-fixed {
    position: fixed;

.g-willChange {
    will-change: transform;

.g-scrolling {
    -webkit-overflow-scrolling: touch;

.g-backface {
    backface-visibility: hidden;

.g-preserve3d {
    transform-style: preserve-3d;

              (function() {
    let old = "";
    let dom = $(".container");
    $('#select').on("change", function(e) {
        let current = $(this).val();
        old = current;
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.