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="item">
  <nav>
    <div class="icon">
  <div class="space top"></div>
  <div class="space middle"></div>
  <div class="space bottom"></div>
</div>
  </nav>
  <h3>Integer nec porttitor</h3>
<!--   <h3 id="price">$35.00</h3>
  <a href="#">free shipping</a> -->
  <div class="img">
    <img src="https://sc01.alicdn.com/kf/HTB1vHGhFpXXXXc6bpXXq6xXFXXX0/220128135/HTB1vHGhFpXXXXc6bpXXq6xXFXXX0.jpg">
  </div><!--img end-->
  <div class="flex">
    <h3 id="price">$35.00</h3>
    <a href="#">free shipping</a>
  </div>
      <p>color</p>
  <div class='color-picker'>
    <div class="border">
      <div class="color black"></div>
    </div>
    <div class="border">
      <div class="color red"></div>
    </div>
    <div class="border">
      <div class="color navy"></div>
    </div>
  </div><!--color-picker end-->
  <p>size</p>
  <div class="size-picker">
    <div class="border size m">m</div>
    <div class="border size l">l</div>
    <div class="border size xl">xl</div>
    <div class="border size xxl">xxl</div>
  </div><!--size-picker end-->
  <div class="amount">
  <a href="#" class="fa fa-minus"></a>
  <span><span id="total"></span> Qty.</span>
  <a href="#" class="fa fa-plus"></a>
</div><!--amount-->
  <a href="#" id="cart-btn"><i class="fa fa-shopping-cart"></i> add to cart</a>
</div><!--item end-->

              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Arsenal');

body{
  height:100%;
  background:linear-gradient(20deg,lightgray,navy);
  font-family:sans-serif;
  display:flex;
  justify-content:center;
}
nav{
  border-bottom:solid 1px lightgray;
  margin-bottom:.50em;
  padding:0 .60em;
  .icon{
    border:solid 1px transparent;
    cursor:pointer;
    width:25px;
    height:30px;
    .top{
      height:2px;
      background:black;
  }
    .middle{
      height:2px;
      background:black;
}
.bottom{
  height:2px;
  width:70%;
  background:black;
}
.space{
  margin:.30em 0;
}
  }
}
.icon:hover .space{
  background:rgb(0,150,200);
}

.item{
  background:white;
  padding:.50em 0 .90em 0;
  margin-bottom:1em;
  width:340px;
  h3{
    text-transform:capitalize;
    text-align:center;
    font-family: 'Arsenal', sans-serif;
    font-weight:200;
    margin:0;
  }
  #price{
    color:rgb(0,150,200);
  }
   a{
    color:gray;
    text-transform:capitalize;
    font-size:.80em;
    display:block;
    text-align:center;
    margin-bottom:.40em;
    transition:.25s;
    &:hover{
      color:rgb(0,150,200);
    }
  }
}
.flex{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  font-family:'Arsenal', sans-serif;
  padding:0 1.5em;
  h3{
    font-size:1.4em;
  }
}
.img{
  overflow:hidden;
  height:350px;
  margin:.40em auto .80em auto;
  box-shadow:0 3px 15px 0 gray;
  img{
    width:100%;
    height:100%;
  }
}

@mixin border ($width,$height,$background-color,$border,$border-radius){
  width:$width;
  height:$height;
  background:$background-color;
  border:$border;
  border-radius:$border-radius; 
}
p{
  width:60px;
  margin:.8em auto;
  text-align:center;
  color:gray;
  font-size:.90em;
  text-transform:uppercase;
  border-bottom:solid 1px lightgray;
}
@mixin colorPosition($width,$height,$background,$border-radius){
  width:$width;
  height:$height;
  background:$background;
  border-radius:50%;
}
.color-picker .border{
  display:flex;
  justify-content:center;
  align-items:center;
}
.color-picker{
  display:flex;
  justify-content:space-around;
  margin:auto;
  width:120px;
  margin-top:.20em;
    .border{
      position:relative;
      cursor:pointer;
    @include border(30px,30px,white,solid 2px lightgray,50%);
      .black{
        @include colorPosition(20px,20px,black,50%);
      }
      .red{
        @include colorPosition(20px,20px,red,50%);
      }
      .navy{
        @include colorPosition(20px,20px,navy,50%);
      }
  } 
}


/***************
    SIZE
***************/
.size-picker{
  padding:0 4em;
  display:flex;
  justify-content:space-around;
  margin:auto;
}
.size-picker .border{
  display:flex;
  justify-content:center;
  align-items:center;
}
.size-picker .border{
  @include border(25px,25px,white,solid 2px lightgray,50px);
  color:gray;
  cursor:pointer;
  font-size:.95em;
  padding:.50em;
  text-transform:uppercase;
  &:hover{
    border-color:gray;
  }
}
.border{
  transition:.25s;
}


.amount a{
  text-decoration:none;
  color:rgb(0,150,200);
  padding:10% 0;
  flex:1;
}
.amount{
  border:solid 1px lightgray;
  height:50px;
  width:200px;
  border-radius:50px;
  display:flex;
  justify-content:space-around;
  align-items:baseline;
  text-align:center;
  overflow:hidden;
  margin:2em auto 1em auto;
}
.amount span{
  flex:2;
  color:rgb(0,170,200);
}
/***********
  BUTTON
***********/
#cart-btn{
  text-decoration:none;
  background:rgb(0,170,200);
  color:white;
  font-family:sans-serif;
  text-transform:uppercase;
  width:150px;
  padding:1em 2em;
  border-radius:50px;
  display:block;
  margin:auto;
  &:hover{
    opacity:.8;
  }
}
/**************************
SIZE PICKED HIGHLIGHT BORDER
***************************/
.size-picker .border.highlight{
  color:rgb(120,170,200);
  border-color:rgb(120,170,200);
}

/****************************
COLOR PICKED HIGHLIGHT BORDER
*****************************/
.border.black-border{
  border-color:black;
}
.border.red-border{
  border-color:red;
}
.border.navy-border{
  border-color:navy;
}
              
            
!

JS

              
                
$(document).ready(function(){
  var count = 1;
$('#total').text(count);
  
  function highlightColor(){
    if($(this).hasClass('black')){
      $('.border').removeClass('red-border navy-border');
      $(this).parent().addClass('black-border');
    } else if($(this).hasClass('red')){
      $('.border').removeClass('black-border navy-border');
              $(this).parent().addClass('red-border');
              } else if($(this).hasClass('navy')){
                $('.border').removeClass('red-border black-border');
                        $(this).parent().addClass('navy-border');
                        }
  }
  
  function highlightSize(){
    if($(this).hasClass('m')){
      $(this).prevAll().removeClass('highlight');
      $(this).nextAll().removeClass('highlight');
       $(this).addClass('highlight');
       } else if($(this).hasClass('l')){
                 $(this).prevAll().removeClass('highlight');
                 $(this).nextAll().removeClass('highlight');
                 $(this).addClass('highlight');
                 } else if($(this).hasClass('xl')){
                     $(this).prevAll().removeClass('highlight');
                    $(this).nextAll().removeClass('highlight');
                     $(this).addClass('highlight');
                 } else if($(this).hasClass('xxl')){
                           $(this).prevAll().removeClass('highlight');
                            $(this).nextAll().removeClass('highlight');
                             $(this).addClass('highlight');
                           }
  }
  
  // will highlight to it's corresponding color
  $('.color').on('click',highlightColor);
  
  // shirt size will hightlight when the user clicks
  $('.size').on('click',highlightSize);
  
  // increment/decrement
  $('.amount').on('click', 'a', function(e) {
    e.preventDefault();
    if ($(this).hasClass('fa-plus')) {
      if (count < 10) {
        count++;
        $('#total').text(count);
      }
    } else if ($(this).hasClass('fa-minus')) {
      if (count > 1) {
        count--;
        $('#total').text(count);
      }
    }
  });
});
              
            
!
999px

Console