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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <header class="header">
  <div class="flower flower--tiny">
    <div class="circle"></div>
    <div class="petal" style="--i: 0"></div>
    <div class="petal" style="--i: 1"></div>
    <div class="petal" style="--i: 2"></div>
    <div class="petal" style="--i: 3"></div>
    <div class="petal" style="--i: 4"></div>
    <div class="petal" style="--i: 5"></div>
    <div class="petal" style="--i: 6"></div>
    <div class="petal" style="--i: 7"></div>
    <div class="petal" style="--i: 8"></div>
    <div class="inner-petal" style="--j: 0"></div>
    <div class="inner-petal" style="--j: 1"></div>
    <div class="inner-petal" style="--j: 2"></div>
    <div class="inner-petal" style="--j: 3"></div>
    <div class="inner-petal" style="--j: 4"></div>
    <div class="inner-petal" style="--j: 5"></div>
    <div class="inner-petal" style="--j: 6"></div>
    <div class="inner-petal" style="--j: 7"></div>
    <div class="inner-petal" style="--j: 8"></div>
  </div>
  <h1 class="h1">CSS Flower Maker</h1>
  <div class="flower flower--tiny">
    <div class="circle"></div>
    <div class="petal" style="--i: 0"></div>
    <div class="petal" style="--i: 1"></div>
    <div class="petal" style="--i: 2"></div>
    <div class="petal" style="--i: 3"></div>
    <div class="petal" style="--i: 4"></div>
    <div class="petal" style="--i: 5"></div>
    <div class="petal" style="--i: 6"></div>
    <div class="petal" style="--i: 7"></div>
    <div class="petal" style="--i: 8"></div>
    <div class="inner-petal" style="--j: 0"></div>
    <div class="inner-petal" style="--j: 1"></div>
    <div class="inner-petal" style="--j: 2"></div>
    <div class="inner-petal" style="--j: 3"></div>
    <div class="inner-petal" style="--j: 4"></div>
    <div class="inner-petal" style="--j: 5"></div>
    <div class="inner-petal" style="--j: 6"></div>
    <div class="inner-petal" style="--j: 7"></div>
    <div class="inner-petal" style="--j: 8"></div>
  </div>
</header>
<aside class="huge-flower-wrapper">
  <div class="flower">
    <div class="circle"></div>
    <div class="petal" style="--i: 0"></div>
    <div class="petal" style="--i: 1"></div>
    <div class="petal" style="--i: 2"></div>
    <div class="petal" style="--i: 3"></div>
    <div class="petal" style="--i: 4"></div>
    <div class="petal" style="--i: 5"></div>
    <div class="petal" style="--i: 6"></div>
    <div class="petal" style="--i: 7"></div>
    <div class="petal" style="--i: 8"></div>
    <div class="inner-petal" style="--j: 0"></div>
    <div class="inner-petal" style="--j: 1"></div>
    <div class="inner-petal" style="--j: 2"></div>
    <div class="inner-petal" style="--j: 3"></div>
    <div class="inner-petal" style="--j: 4"></div>
    <div class="inner-petal" style="--j: 5"></div>
    <div class="inner-petal" style="--j: 6"></div>
    <div class="inner-petal" style="--j: 7"></div>
    <div class="inner-petal" style="--j: 8"></div>
  </div>
</aside>
<main class="main">
  <section class="question question--1">
    <h2 class="question__h2">Choose a color scheme:</h2>
    <div class="question__option">
      <input type="radio" class="question__radio" id="color-scheme-1" name="color-scheme"/ checked>
      <label for="color-scheme-1" class="question__label question__label--colors question__label--colors1"></label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="color-scheme-2" name="color-scheme"/>
      <label for="color-scheme-2" class="question__label question__label--colors question__label--colors2"></label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="color-scheme-3" name="color-scheme"/>
      <label for="color-scheme-3" class="question__label question__label--colors question__label--colors3"></label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="color-scheme-4" name="color-scheme"/>
      <label for="color-scheme-4" class="question__label question__label--colors question__label--colors4"></label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="color-scheme-5" name="color-scheme"/>
      <label for="color-scheme-5" class="question__label question__label--colors question__label--colors5"></label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="color-scheme-6" name="color-scheme"/>
      <label for="color-scheme-6" class="question__label question__label--colors question__label--colors6"></label>
    </div>
  </section>
  <section class="question question--2">
    <h2 class="question__h2">How many petals?</h2>
    <div class="question__option">
      <input type="radio" class="question__radio" id="petals-1" name="petals" checked/>
      <label for="petals-1" class="question__label question__label--text">5</label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="petals-2" name="petals"/>
      <label for="petals-2" class="question__label question__label--text">6</label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="petals-3" name="petals"/>
      <label for="petals-3" class="question__label question__label--text">7</label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="petals-4" name="petals"/>
      <label for="petals-4" class="question__label question__label--text">8</label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="petals-5" name="petals"/>
      <label for="petals-5" class="question__label question__label--text">9</label>
    </div>
  </section>
  <section class="question question--3">
    <h2 class="question__h2">How many inner petals?</h2>
    <div class="question__option">
      <input type="radio" class="question__radio" id="inner-petals-1" name="inner-petals" checked />
      <label for="inner-petals-1" class="question__label question__label--text">5</label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="inner-petals-2" name="inner-petals"/>
      <label for="inner-petals-2" class="question__label question__label--text">6</label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="inner-petals-3" name="inner-petals"/>
      <label for="inner-petals-3" class="question__label question__label--text">7</label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="inner-petals-4" name="inner-petals"/>
      <label for="inner-petals-4" class="question__label question__label--text">8</label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="inner-petals-5" name="inner-petals"/>
      <label for="inner-petals-5" class="question__label question__label--text">9</label>
    </div>
  </section>
  <section class="question question--4">
    <h2 class="question__h2">Choose a size for the inner circle:</h2>
    <div class="question__option">
      <input type="radio" class="question__radio" id="inner-circle-1" name="inner-circle" checked />
      <label for="inner-circle-1" class="question__label question__label--text"> Small</label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="inner-circle-2" name="inner-circle"/>
      <label for="inner-circle-2" class="question__label question__label--text">Medium</label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="inner-circle-3" name="inner-circle"/>
      <label for="inner-circle-3" class="question__label question__label--text">Large</label>
    </div>
    <div class="question__option">
      <input type="radio" class="question__radio" id="inner-circle-4" name="inner-circle"/>
      <label for="inner-circle-4" class="question__label question__label--text">Very Large</label>
    </div>
  </section>
  <section class="question question--button">
    <div class="question__option">
      <input type="checkbox" class="question__radio" id="flower-dance" name="flower-dance"/>
      <label for="flower-dance" class="question__label question__label--button"></label>
    </div>
   </section>
  <section class="flower-wrapper">
    <div class="flower">
      <div class="circle"></div>
      <div class="petal" style="--i: 0"></div>
      <div class="petal" style="--i: 1"></div>
      <div class="petal" style="--i: 2"></div>
      <div class="petal" style="--i: 3"></div>
      <div class="petal" style="--i: 4"></div>
      <div class="petal" style="--i: 5"></div>
      <div class="petal" style="--i: 6"></div>
      <div class="petal" style="--i: 7"></div>
      <div class="petal" style="--i: 8"></div>
      <div class="inner-petal" style="--j: 0"></div>
      <div class="inner-petal" style="--j: 1"></div>
      <div class="inner-petal" style="--j: 2"></div>
      <div class="inner-petal" style="--j: 3"></div>
      <div class="inner-petal" style="--j: 4"></div>
      <div class="inner-petal" style="--j: 5"></div>
      <div class="inner-petal" style="--j: 6"></div>
      <div class="inner-petal" style="--j: 7"></div>
      <div class="inner-petal" style="--j: 8"></div>
    </div>
  </section>
</main>
              
            
!

CSS

              
                body {
  background-color: var(--bg-color, lavenderBlush);
  color: #222;
  font-family: 'Indie Flower', sans-serif;
  margin: 0;
  padding: 0;
  --border-radius: 10px;
  
  --dark: #222;
  --light: #f9f9f9;
  
  --color-scheme-1-dark: paleVioletRed;
  --color-scheme-1-light: lightPink;
  --color-scheme-2-dark: darkOliveGreen;
  --color-scheme-2-light: darkSeaGreen;
  --color-scheme-3-dark: sandyBrown;
  --color-scheme-3-light: peachPuff;
  --color-scheme-4-dark: steelBlue;
  --color-scheme-4-light: lightBlue;
  --color-scheme-5-dark: mediumPurple;
  --color-scheme-5-light: lavender;
  --color-scheme-6-dark: darkRed;
  --color-scheme-6-light: lightCoral;
}

.header {
  align-items: center;
  display: flex;
  gap: 8px;
  padding: 24px;
}

.h1 {
  font-size: 40px;
  margin: 0;
}

.main {
  column-gap: 48px;
  display: grid;
  grid-template-columns: 1fr;
  padding: 0 24px 24px 24px;
  row-gap: 16px;
}

/* flower */
.huge-flower-wrapper {
  align-items: center;
  bottom: 0;
  display: var(--visible-huge-flower, none);
  flex-direction: column;
  left: 0;
  justify-content: center;
  margin: auto;
  position: absolute;
  right: 0;
  height: 75vh;
  top: 0;
  width: 75vw;
  z-index: 2;
  --flower-size: 750px;
  --inner-circle-size: 37.5px;
}

.flower--tiny {
  --flower-size: 36px;
  --inner-circle-size: 1.8px;
}

.flower {
  display: block;
  height: var(--flower-size, 250px);
  position: relative;
  width: var(--flower-size, 250px);
}

.circle {
  background-color: var(--inner-circle-color, #222);
  border-radius: 100%;
  bottom: 0;
  height: var(--inner-circle-size, 5px);
  left: 0;
  margin: auto;
  position: absolute;
  right: 0;
  top: 0;
  width: var(--inner-circle-size, 5px);
  z-index: 1;
}

.petal {
  --height: calc((var(--flower-size, 250px)*2)/var(--petals-number, 9));
  --width: 50%;
	--rotation: calc(var(--i)*360deg/var(--petals-number, 9));
  background-color: var(--petals-color, paleVioletRed);
  border-radius: 50%;
  height: var(--height);
  left: 50%;
  margin: calc(-.5*var(--height)) calc(-.5*var(--width));
  position: absolute;
  top: 50%;
	transform: rotate(var(--rotation)) 
		translate(calc(var(--translate-value, 1.25)*var(--height)));
  width: var(--width);
}

.inner-petal {
  --height: calc((var(--flower-size, 250px)/1.75)/var(--inner-petals-number, 6));
  --width: 20%;
	--rotation: calc(var(--j)*360deg/var(--inner-petals-number, 6));
  background-color: var(--inner-petals-color, lightPink);
  border-radius: 50%;
  height: var(--height);
  left: 50%;
  margin: calc(-.5*var(--height)) calc(-.5*var(--width));
  position: absolute;
  top: 50%;
	transform: rotate(var(--rotation)) 
		translate(calc(var(--inner-translate-value, 1.25)*var(--height)));
  width: var(--width);
}

/* question styling */
.question {
  background-color: var(--light);
  border-radius: var(--border-radius);
  border: 2px dashed var(--dark);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  grid-column: 1;
  padding: 32px;
}

.question--4 {
  column-gap: 24px;
}

.question--button {
  background-color: transparent;
  border: none;
  padding: 0;
  width: fit-content;
  z-index: 2;
}

.question__h2 {
  flex-basis: 100%;
  margin: 0;
}

/* labels and radio buttons */
.question__label {
  border-radius: 100%;
  cursor: pointer;
  display: block;
  font-size: 24px;
  line-height: 1;
  font-weight: bold;
  transition: transform .3s ease-in-out;
}

.question__label--button {
  background-color: var(--dark);
  border-radius: var(--border-radius);
  color: var(--light);
  padding: 16px;
  text-transform: uppercase;
}

.question__label--button:after {
  content: var(--button-text);
}

.question__label--text {
  padding: 4px 8px;
}

.question__label--colors {
  display: block;
  height: 48px;
  opacity: .75;
  width: 48px;
} 

.question__label--colors1 {
  background: linear-gradient(var(--color-scheme-1-dark) 0% 50%, var(--color-scheme-1-light) 51% 100%);
}

.question__label--colors2 {
  background: linear-gradient(var(--color-scheme-2-dark) 0% 50%, var(--color-scheme-2-light) 51% 100%);
}

.question__label--colors3 {
  background: linear-gradient(var(--color-scheme-3-dark) 0% 50%, var(--color-scheme-3-light) 51% 100%);
}

.question__label--colors4 {
  background: linear-gradient(var(--color-scheme-4-dark) 0% 50%, var(--color-scheme-4-light) 51% 100%);
}

.question__label--colors5 {
  background: linear-gradient(var(--color-scheme-5-dark) 0% 50%, var(--color-scheme-5-light) 51% 100%);
}

.question__label--colors6 {
  background: linear-gradient(var(--color-scheme-6-dark) 0% 50%, var(--color-scheme-6-light) 51% 100%);
}

.question__label--button:hover,
question__label--button:active,
question__label--button:focus {
  color: var(--dark);
  animation: crazy-button .5s infinite ease-in-out;
}

.question__label--colors:hover,
question__label--colors:active,
.question__radio:checked + .question__label--colors {
  opacity: 1;
}

.question__label--text:hover,
question__label--text:active,
.question__radio:checked + .question__label--text {
  border: 1px solid var(--dark);
}

.question__radio:checked + .question__label--text {
  transform: scale(1.5);
}

.question__radio:checked + .question__label--colors {
  transform: scale(1.25);
}

.question__radio {
  opacity: 0;
  position: absolute;
}

/* radio buttons + has + custom properties hack to change flower */
body:has(input[id="color-scheme-1"]:checked) { 
 --petals-color: paleVioletRed; 
 --inner-petals-color: lightPink;
}

body:has(input[id="color-scheme-2"]:checked) { 
 --petals-color: darkOliveGreen;
 --inner-petals-color: darkSeaGreen;
  --bg-color: honeyDew;
}

body:has(input[id="color-scheme-3"]:checked) { 
 --petals-color: sandyBrown;
 --inner-petals-color: peachPuff;
  --bg-color: cornSilk;
}

body:has(input[id="color-scheme-4"]:checked) { 
 --petals-color: steelBlue;
 --inner-petals-color: lightBlue;
  --bg-color: aliceBlue;
}

body:has(input[id="color-scheme-5"]:checked) { 
 --petals-color: mediumPurple;
 --inner-petals-color: lavender;
  --bg-color: thistle;
}

body:has(input[id="color-scheme-6"]:checked) { 
 --petals-color: darkRed;
 --inner-petals-color: lightCoral;
  --bg-color: lightPink;
}

body:has(input[id="petals-1"]:checked) {
  --petals-number: 5;
  --translate-value: .75;
}

body:has(input[id="petals-2"]:checked) {
  --petals-number: 6;
  --translate-value: .9;
}

body:has(input[id="petals-3"]:checked) {
  --petals-number: 7;
  --translate-value: 1;
}

body:has(input[id="petals-4"]:checked) {
  --petals-number: 8;
}

body:has(input[id="petals-5"]:checked) {
  --petals-number: 9;
}

body:has(input[id="inner-petals-1"]:checked) {
  --inner-petals-number: 5;
  --inner-translate-value: .75;
}

body:has(input[id="inner-petals-2"]:checked) {
  --inner-petals-number: 6;
  --inner-translate-value: .9;
}

body:has(input[id="inner-petals-3"]:checked) {
  --inner-petals-number: 7;
}

body:has(input[id="inner-petals-4"]:checked) {
  --inner-petals-number: 8;
}

body:has(input[id="inner-petals-5"]:checked) {
  --inner-petals-number: 9;
}

body:has(input[id="inner-circle-1"]:checked) {
  --inner-circle-size: 5px;
}

body:has(input[id="inner-circle-2"]:checked) {
  --inner-circle-size: 10px;
}

body:has(input[id="inner-circle-3"]:checked) {
  --inner-circle-size: 15px;
}

body:has(input[id="inner-circle-4"]:checked) {
  --inner-circle-size: 25px;
}

body:has(input[id="flower-dance"]:checked) { 
 --visible-huge-flower: flex;
 --button-text: 'No more action, thanks!';
}

body:has(input[id="flower-dance"]:not(:checked)) { 
 --visible-huge-flower: none;
 --button-text: 'I need more action!!!';
}

body:has(input[id="flower-dance"]:checked) .flower { 
  animation: crazy-flower .3s infinite ease-in-out;
}

/* animations */
@keyframes crazy-flower {
  0% {
    --petals-color: paleVioletRed; 
    --inner-petals-color: lightPink;
    transform: rotate(0deg);
  }=
  16.6% {
    --petals-color: darkOliveGreen;
    --inner-petals-color: darkSeaGreen;
    transform: rotate(60deg);
  }
  32.4% {
    --petals-color: sandyBrown;
    --inner-petals-color: peachPuff;
    transform: rotate(120deg);
  }
  49% {
    --petals-color: steelBlue;
    --inner-petals-color: lightBlue;
    transform: rotate(180deg);
  }
  65.6% {
    --petals-color: mediumPurple;
    --inner-petals-color: lavender;
    transform: rotate(270deg);
  }
  82.2% {
    --petals-color: darkRed;
    --inner-petals-color: lightCoral;
    transform: rotate(270deg);
  }
  100% {
    --petals-color: paleVioletRed; 
    --inner-petals-color: lightPink;
    transform: rotate(360deg);
  }
}

@keyframes crazy-button {
  0% {
    background-color:  var(--color-scheme-1-dark);
  }
  10% {
    background-color:  var(--color-scheme-1-light);
  }
  20% {
    background-color:  var(--color-scheme-2-dark);
  }
  30% {
    background-color:  var(--color-scheme-2-light);
  }
  40% {
    background-color:  var(--color-scheme-3-dark);
  }
  50% {
    background-color:  var(--color-scheme-3-light);
  }
  60% {
    background-color:  var(--color-scheme-4-dark);
  }
  70% {
    background-color:  var(--color-scheme-4-light);
  }
  80% {
    background-color:  var(--color-scheme-5-dark);
  }
  90% {
    background-color:  var(--color-scheme-5-light);
  }
  100% {
    background-color:  var(--color-scheme-1-dark);
  }
}

/* media queries */
@media (min-width: 668px) {
  .main {
    grid-template-columns: 1fr .75fr;
  }
  
  .flower-wrapper {
    align-self: center;
    grid-column: 2;
    grid-row-start: 1;
    grid-row-end: 4;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console