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

              
                <article>
  <figure>
    <img src="https://fakeimg.pl/150/">
  </figure>
  <form>
  <input type="text" placeholder="Introduce tu nombre"/>
  <input id="rangeField" type="range" list="mydata" min="0" max="100" value="20" step="1" oninput="changeVar(rangeField.value,rangeField.min, rangeField.max)">
  <output id="output" value="20"></output>
  <fieldset>
    <input type="radio" name="gender" aria-label="Hombre"/>
    <input type="radio" name="gender" aria-label="Mujer"/>
  </fieldset>
    <div class="buttonSet">
      <button type="button">Cancelar</button>
        <button type="button" class="submit">Guardar</button>
      </div>
</form>
<article>
              
            
!

CSS

              
                $module: 48px;
$spacing: 12px;
*{box-sizing: border-box}
body {
  margin: 0;
  background: #f0f0f0;
  font: normal 14px Arial, Helvetica, san-serif;
  color: #336;
}
article {
  display: flex;
  align-content: center;
  align-items: center;
  justify-content: center;
}
figure {
  display: inline-block;
  overflow: hidden;
  width: auto;
  padding: 9px;
  border-radius: 50%;
  border: solid 1px white;
  box-shadow: 4px 4px $spacing 6px rgba(0,0,0,.05), -4px -4px $spacing 6px rgba(255,255,255,1), inset 4px 4px $spacing rgba(0,0,0,0.05), inset -4px -4px $spacing rgba(255,255,255,.5);
}
img {
  display: block;
  border-radius: 50%;
}
form {
  // padding: $spacing;
  width: 300px;
}
[type=text]{
/*   display: block; */
  width: 100%;
  margin: $spacing 0;
  padding: $spacing $module/2;
  line-height: $spacing;
  border-radius: $module/2;
  border: 0;
  outline: solid 1px rgba(255,255,255,0.5);
/*   border-color: #fff #eee #eee #fff; */
  box-shadow: inset 3px 3px 9px rgba(0,0,0,0.125), inset -3px -3px 9px rgba(255,255,255,1);
  background: transparent;
}
[type=text]:focus {
  background: #f6f6f6;
}
fieldset {
  box-sizing: border-box;
  display: inline-block;
  width: 100%;
  margin: $spacing 0;
  padding: 0;
  font-size: 0;
  border: none;
  border-radius: $module/2;
  box-shadow: 3px 3px 9px rgba(0,0,0,0.15), -3px -3px 9px 3px rgba(255,255,255,1);
  background: #ccc;
  outline: solid 1px rgba(255,255,255,0.5);
}

[type=radio]{
  display: inline-block;
  appearance: none;
  width: 50%;
  margin: 0;
  padding: 0;
  text-align: center;
  cursor: pointer;
}
[type=radio]:after {
  content: attr(aria-label);
  box-sizing: border-box;
  display: block;
  height:$module - 4px;
  padding: $spacing $module/2;
  font-weight: bold;
  line-height: $module/2;
  color: #99F;
  border: solid 1px rgba(255,255,255,0.2);
  background: #f0f0f0;
}
[type=radio]:first-child:after {
  border-radius: $module/2 0 0 $module/2;
}
[type=radio]:last-child:after {
  border-radius: 0 $module/2 $module/2 0;
}
[type=radio]+[type=radio]:after {
  margin-left: 1px;
}
[type=radio]:checked:after {
  box-shadow: inset 3px 3px 9px rgba(0,0,0,0.15), inset -3px -3px 9px rgba(255,255,255,1);
  color: #33A;
  background: #f6f6f6;
}
[type=range]{
   -webkit-appearance: none;
  width: calc(100% - 90px);
  margin: $spacing;
  vertical-align: middle;
  border: none;
  outline: none;
  border-radius: $spacing/2;
  background: transparent;
}
@mixin track() {
  height: $spacing*2/3;
  padding: 0;
  cursor: pointer;
  border-radius: $spacing/2;
  box-shadow: inset 2px 2px 6px rgba(10,10,100,.5), inset -2px -2px 6px rgba(200,200,255,.5);
  background: linear-gradient(to right, #99F 0%, rgba(#33A,1) var(--progressW), #f0f0f0 var(--progressW), #f0f0f0 100%);
  border: solid 1px rgba(white,0.75);
}
@mixin thumb() { 
  box-sizing: border-box;/*FF*/
  -webkit-appearance: none;
  width: $module/2;
  height: $module/2;
  margin-top: -$spacing*2/3-1px;
  border: $spacing/2 solid #eee;
  border-radius: 50%;
  background: #99F;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .5), inset 1px 1px 3px rgba(#336,.5);
}
@mixin active() {
    width: $module*0.75;
    height: $module*0.75;
    margin-top: -$spacing*1.25;
    background: #99F;
}
@mixin progress() {
    // background: #99F;
  background: transparent;
}
[type=range] {
  &::-webkit-slider-runnable-track { @include track }
  &::-moz-range-track { @include track }
  &::-ms-track { @include track }

  &::-webkit-slider-thumb { @include thumb }
  &::-moz-range-thumb { @include thumb }
  &::-ms-thumb { @include thumb }

  &:active::-webkit-slider-thumb { @include active }
  &:active::-moz-range-thumb { @include active }
  &:active::-ms-thumb { @include active }
  
  &::-moz-range-progress { @include progress }
  &::-ms-fill-upper { @include progress }
}
output {
  white-space: nowrap;
}

.buttonSet {
  display: flex;
  flex-flow: row nowrap;
  justify-content: space-between;
}
button {
  box-sizing: border-box;
  width: calc(50% - #{$spacing});
  height: $module;
  margin: $spacing 0;
  padding: $spacing;
  font-weight: bold;
  color: #99F;
  border: solid 4px #f0f0f0;
  border-radius: $module/2;
  --borderCLR: rgba(0,0,0,.15);
  --lightCLR: rgba(240,240,255,.5);
  --shadowCLR: rgba(0,0,0,0.05);
  box-shadow: 0px 0px 1px 1px var(--borderCLR), 0px 0px 2px 2px white, inset 3px 3px 9px var(--shadowCLR), inset -3px -3px 9px var(--lightCLR);
  // outline: solid 1px white;
  background: transparent;
  cursor: pointer;
}
.submit {
  color: white;
  border-color: #99F;
  background-color: #99F;
  --lightCLR: rgba(200,200,255,.75);
  --shadowCLR: rgba(0,0,100,0.15);
  
}
button:active {
  position: relative;
  top: 2px;
  left: 1px;
  box-shadow: -1px -1px 1px 1px var(--borderCLR), -1px -1px 2px 2px white, inset 3px 3px 9px var(--shadowCLR), inset -3px -3px 9px var(--lightCLR);
  border-width: 4px 2px 2px 4px;
}
@media all and (max-width:600px) {
  article {
    flex-direction: column;
  }
}
              
            
!

JS

              
                function changeVar(value, min, max){
  var range = max - min;
  var progressW = Math.round((value-min)/range*100);
  $('#rangeField').css('--progressW', progressW +'%');
  $('#output').val(progressW +' años')
};
changeVar(20,0,100);
              
            
!
999px

Console