LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

Selection CSS Counter

Select characters:

Total selected:
CSS
@import url(https://fonts.googleapis.com/css?family=Droid+Sans:700);

/* counters */

body {
  counter-reset: characters;
}

input:checked {
  counter-increment: characters;
}

.total::after {
  content: counter(characters);
}

/* the rest is just to make things pretty */

body {
  margin: 32px;
  font: 700 32px/1 'Droid Sans', sans-serif;
  color: #fff;
  background-color: #3f584e;
}

h1 {
  margin: 0 0 32px;
  font-size: 48px;
}

h2 {
  margin: 0 0 8px 8px;
  font-size: inherit;
}

section {
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 4px;
  overflow: hidden;
  background-color: rgba(255, 255, 255, .1);
}

input {
  position: absolute;
  left: -9999px;
}

label {
  float: left;
  margin: 8px;
  padding: 16px;
  border-radius: 4px;
  border: solid 2px rgba(255, 255, 255, .4);
  background-color: rgba(255, 255, 255, .2);
  cursor: pointer;
  transition: all .1s;
}

label::before {
  display: inline;
}

input:checked + label {
  border: solid 2px #fff;
  background-color: rgba(255, 255, 255, .4);
  box-shadow: 0 0 10px #fff;
}

.total {
  padding: 16px 24px;
}
Host Instantly Drag and Drop Website Builder

 

Description

Count how many selections a user has made with CSS counters. No JavaScript.
Term
Mon, 11/27/2017 - 21:50

Related Codes

Pen ID
Pen ID
Pen ID