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

              
                <p>Turn bland elements into cards</p>
<button id="toggle">Before/After</button>
<h2>Pick a font size</h2>
      <div class="no-radio-buttons">
        <input type="radio" id="small" name="font_size" value="small">
          <label for="small">Small - 16 pixels (Smartphones)</label>
       
        <br>
          <input type="radio" id="medium" name="font_size" value="medium">
          <label for="medium">Medium - 18 pixels (Laptops)</label>
        <br>
       
          <input type="radio" id="large" name="font_size" value="large">
          <label for="large">Large - 20 pixels (Desktops)</label> 
       <br>
          <input type="radio" id="xtreme" name="font_size" value="xtreme">
          <label for="xtreme">Extreme - 24 pixels (4K screens)</label>
      
        
      </div>

      <!-- radio cards -->
      <div class="radio-cards">
        
        <div class="radio-card">
          <input type="radio" id="small" name="font_size" value="small"><label for="small">SMALL</label><br> <br>
          <p><span class="pixels-no">16</span>
          <b>pixels</b><br>Smartphones</p>
        </div>
        <div class="radio-card">
          <input type="radio" id="small" name="font_size" value="small"><label for="small">MEDIUM</label><br> <br>
          <p><span class="pixels-no">18</span>
          <b>pixels</b><br>Laptops</p>
        </div>
        <div class="radio-card">
          <input type="radio" id="small" name="font_size" value="small"><label for="small">LARGE</label><br> <br>
          <p><span class="pixels-no">20</span>
          <b>pixels</b><br>Desktops</p>
        </div>
        <div class="radio-card">
          <input type="radio" id="small" name="font_size" value="small"><label for="small">EXTREME</label><br> <br>
          <p><span class="pixels-no">24</span>
          <b>pixels</b><br>4K screens</p>
        </div>
        
        
      </div>
              
            
!

CSS

              
                /* variables */

@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap");
:root{
  --ff: "Montserrat", sans-serif;
   --colorp: #f9f9f9;
  --colorp2: #fff;
  --colora: #ffe537;
  --colora2: #537fe7;
  --colorbody: #1e1e1e;
  --colors: #333;
    --h2: bold clamp(2rem, 2.5vw, 3rem)/1.5em var(--ff);
    --p: 1rem/1.8em var(--ff);
 --colorgray: hsl(0, 0%, 60%);
  --graygradient: linear-gradient(45deg, hsl(0, 0%, 20%), hsl(0, 0%, 15%));
}
body {
  width: 90vw;
  margin: 40px auto;
  background-color: var(--colorbody);
  color: var(--colorp);
  font: var(--p);
}
h2{font: var(--h2);}
button{
  background: none;
  padding: 12px 24px;
  font: var(--p);
  color: var(--colora);
  border-radius: 12px;
  border: solid 1px var(--colora);
  cursor: pointer;
}
button:active{
  scale: .95;
}

label{font: var(--p);}

.no-radio-buttons {
  display: none;
}
radio-buttons {
  display: block;
}


/* Actual code */

.radio-cards{
  font: var(--p);
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.no-radio-cards {
  display: none;
}
.radio-card{
  padding: 20px;
  border-radius: 20px;
  background: var(--graygradient);
  position: relative;
  box-shadow: var(--shadow);
  flex: 1;
  min-width: 150px;
}

.radio-card input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer; 
}

.radio-card input[type="radio"]::before {
  content: '';
  position: absolute;
  top: 20px;
  right: 20px;
  width: 20px;
  height: 20px;
  background-color: none;
  border: solid 2px var(--colorp);
  border-radius: 50%;
}
.radio-card input[type="radio"]:checked::before {
  border: solid 2px var(--colora2);
  background-color: var(--colora2);
  background-image: url('https://www.iamsajid.com/supercharge/tick.svg');
  background-size: cover;
  
}

.radio-card label{
  font-weight: bold;
  letter-spacing: 2px;
  color: var(--colorgray);
  margin-left: -8px;
}
.pixels-no{
  font: var(--h2);
  line-height: .5em;
}
              
            
!

JS

              
                // Just for the toogle 

const Toggle = document.getElementById("toggle");
const radioButtons = document.querySelector(".no-radio-buttons");
const radioCards = document.querySelector(".radio-cards");
Toggle.addEventListener("click", () => {
  radioButtons.classList.toggle("no-radio-buttons");
  radioButtons.classList.toggle("radio-buttons");

  radioCards.classList.toggle("radio-cards");
  radioCards.classList.toggle("no-radio-cards");
});
              
            
!
999px

Console