Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <div class="wall">
  <h1>iPhone Price Comparison</h1>
  <div class="back">
    <ul>
      <li class="xs-max"><span>$1099 ~ $1449</span></li>
      <li class="xs"><span>$999 ~ $1349</span></li>
      <li class="xr"><span>$749 ~ $899</span></li>
      <li class="x"><span>$999 ~ $1149</span></li>
    </ul>
  </div>
  <div class="side">
    <ul>
      <li class="xs-max">iPhone XS Max</li>
      <li class="xs">iPhone XS</li>
      <li class="xr">iPhone XR</li>
      <li class="x">iPhone X</li>
    </ul>
  </div>
</div>
              
            
!

CSS

              
                body {
    margin: 0;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(lightblue, skyblue);
}

.wall {
    width: 60em;
    height: 40em;
    font-size: 10px;
    border: 1em solid rgba(255, 255, 255, 0.5);
    border-radius: 2em;
    display: grid;
    grid-template-columns: 0 4fr 1fr;
    overflow: hidden;
}

h1 {
    position: relative;
    width: 20em;
    margin: 1em;
    color: white;
    font-family: sans-serif;
}

.back,
.side {
    display: flex;
    align-items: center;
}

.back {
    background: linear-gradient(to right, #555, #ddd);
    justify-content: flex-end;
}

.side {
    background: 
        radial-gradient(
            at 0% 50%,
            rgba(0, 0, 0, 0.2) 25%,
            rgba(0, 0, 0, 0) 90%
        ),
        linear-gradient(to right, #ddd, #ccc);
    perspective: 1000px;
}

ul {
    list-style-type: none;
    padding: 0;
    --max-price: 1449;
    display: flex;
    flex-direction: column;
}

.back ul {
    width: 75%;
    align-items: flex-end;
}

.side ul {
    width: 100%;
    transform-origin: left;
    transform: rotateY(-75deg) scaleX(4);
}

ul li {
    height: 5em;
    background: var(--c);
    animation: show 1s linear forwards;
    transform-origin: right;
    transform: scaleX(0);
}

@keyframes show {
    to {
        transform: scaleX(1);
    }
}

ul li.xs-max {
    --c: tomato;
    --high-price: 1449;
    --low-price: 1099;
    --c2: orangered;
    z-index: 5;
}

ul li.xs {
    --c: coral;
    --high-price: 1349;
    --low-price: 999;
    --c2: tomato;
    z-index: 4;
}

ul li.xr {
    --c: lightsalmon;
    --high-price: 899;
    --low-price: 749;
    --c2: coral;
    z-index: 3;
}

ul li.x {
    --c: deepskyblue;
    --high-price: 1149;
    --low-price: 999;
    --c2: dodgerblue;
    z-index: 2;
}

.back ul li {
    width: calc(var(--high-price) / var(--max-price) * 100%);
    --percent: calc(var(--low-price) / var(--high-price) * 100%);
    background: linear-gradient(
        to left,
        var(--c) var(--percent),
        var(--c2) var(--percent)
    );
    position: relative;
    filter: drop-shadow(0 1em 1em rgba(0, 0, 0, 0.3));
    animation-delay: 1s;
}

.back ul li::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    transform: translateX(-3em);
    border-right: 3em solid var(--c2);
    border-top: 2.5em solid transparent;
    border-bottom: 2.5em solid transparent;
}

.back ul li span {
    position: absolute;
    width: 95%;
    text-align: right;
    font-size: 1.25em;
    line-height: 4em;
    color: white;
    font-family: sans-serif;
}

.side ul li {
    padding-right: 30%;
    text-align: right;
    color: white;
    font-family: sans-serif;
    line-height: 5em;
}

              
            
!

JS

              
                
              
            
!
999px

Console