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

              
                - const randomInRange = (min, max) => Math.floor(Math.random() * max - min + 1) + min;
- const x = randomInRange(0, 100);
- const y = randomInRange(0, 100);
mixin flower(x, y)
  .flower(style=`--x: ${x}; --y: ${y};`)
    - let p = 0;
    while (p < 4)
      .flower__petal(class=`flower__petal--${p}`)
        - let s = 0;
        while (s < 4)
          div
          - s++;
      - p++;
    .flower__core
+flower(x, y)

              
            
!

CSS

              
                *
  box-sizing border-box
  
:root
  --unit 1vmin
  --stroke hsl(0, 0%, 10%)
  --stroke-border 0.2vmin solid hsl(0, 0%, 10%)

c($path)
  -webkit-clip-path $path
  clip-path $path
    
body
  background hsl(180, 100%, 95%)
  min-height 100vh
  display flex
  align-items center
  justify-content center

.flower
  --petal-color hsl(290, 100%, 80%)
  height calc(var(--size, 20) * var(--unit))
  width calc(var(--size, 20) * var(--unit))
  position absolute
  top calc(var(--y) * 1%)
  left calc(var(--x) * 1%)
  transform translate(-50%, -50%) rotate(calc(var(--r, 0) * 1deg))

  *
  *:after
  *:before
    position absolute
  
  &__core
    top 50%
    left 50%
    height 30%
    width 30%
    border-radius 50%
    border var(--stroke-border)
    transform translate(-50%, -50%)
    background hsla(60, 100%, 50%, 1)
    transform-style preserve-3d

    &:after
    &:before
      content ''
      height 25%
      width 220%
      background var(--stroke)
      border-radius 5% / 50%
      top 50%
      left 50%
      transform translate3d(-50%, -50%, -1px)

    &:after
      transform translate3d(-50%, -50%, -1px) rotate(90deg)

  &__petal
    height 50%
    width 50%
    top 0
    left 50%
    transform translate(-50%, 0)
    transform-origin 50% 100%
    c(polygon(-50% 0, 50% 100%, 150% 0))

    &:after
      content ''
      width 60%
      left 50%
      height 100%
      border-radius 50%
      border-top u(10) solid var(--petal-color, var(--default-petal-color))
      transform-origin 50% 0
      transform translate(-50%, 0) rotate(180deg) translate(0, -34%)
      c(inset(0 0 80% 0))

    &--0
      transform translate(-50%, 0) rotate(0deg)
    &--1
      transform translate(-50%, 0) rotate(90deg)
    &--2
      transform translate(-50%, 0) rotate(180deg)
    &--3
      transform translate(-50%, 0) rotate(270deg)


    & > div:nth-of-type(1)
      left 50%
      width 60%
      // transform-origin 0 25%
      height 100%
      bottom 0
      border-radius 50% / 25%
      background var(--stroke)
      transform-origin 50% 100%
      transform translate(-50%, 0) rotate(-23deg) translate(0, 0)

    & > div:nth-of-type(2)
      left 50%
      width 60%
      // transform-origin 100% 25%
      height 100%
      border-radius 50% / 25%
      background var(--stroke)
      transform-origin 50% 100%
      transform translate(-50%, 0) rotate(23deg) translate(0, 0)


      &:after
        content ''
        height 100%
        width 100%
        border-top u(10) solid var(--stroke)
        border-radius 50%
        transform-origin 50% 0
        transform rotate(-23deg) rotate(-180deg) translate(65%, -18%)
        c(inset(0 0 81% 0))


    & > div:nth-of-type(3)
      left 50%
      width 100%
      height 100%
      bottom 0
      transform translate(-50%, 0)
      c(polygon(-34% 0, 50% 90%, 134% 0))


      &:after
      &:before
        content ''
        height 100%
        width 43%
        left 50%
        bottom 0
        border-radius 50% / 25%
        background var(--petal-color, var(--default-petal-color))
      &:before
        transform translate(-50%, 0) rotate(37deg) translate(27%, 0%)
      &:after
        transform translate(-50%, 0) rotate(-37deg) translate(-27%, 0%)
              
            
!

JS

              
                
              
            
!
999px

Console