cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="title">CSS3 Filters</div>
<div class="error"></div>
<div class="container">
  <div class="switch white">
    <input type="radio" name="switch" id="switch-off" value = "off" />
    <input type="radio" name="switch" id="switch-on" checked value="on"/>
    <label for="switch-off">Off</label>
    <label for="switch-on">On</label>
    <span class="toggle"></span>
  </div>
</div>

<ul class="social-icons filter">
  <li class="icon icon-facebook"></li>
  <li class="icon icon-twitter"></li>
  <li class="icon icon-gplus"></li>
  <li class="icon icon-pintrest"></li>
  <li class="icon icon-youtube"></li>
</ul>
            
          
!
            
              body {
  background: #F1F1F1;
}

.title, .error {
  margin: auto;
  margin-bottom: 5%;
  text-align: center;
  font-family: "Lato", sans-serif;
}

.title {
  color: #444;
  font-size: 4em;
}

.error {
  color: #ED4337;
  font-size: 1.5em;
}

/* Social Icons Styles */
.social-icons {  
  margin-top: 10%;
  text-align: center;
  margin-left: -10px;
}

.icon {
  display: inline-block;
  height: 128px;
  width: 128px;
  background-repeat: no-repeat;
  background-size: contain;
}

.icon:hover {
  cursor: pointer;
}

.icon,
.icon:hover {
  -webkit-transition: all .5s ease;
     -moz-transition: all .5s ease;
      -ms-transition: all .5s ease;
       -o-transition: all .5s ease;
          transition: all .5s ease;
}

.social-icons.filter .icon {
  -webkit-filter: grayscale(1);
     -moz-filter: grayscale(1);
      -ms-filter: grayscale(1); /* Just in Case IE provides it with prefix. */
          filter: grayscale(1);
}

.social-icons.filter .icon:hover {
  -webkit-filter: grayscale(0);
     -moz-filter: grayscale(0);
      -ms-filter: grayscale(0); /* Just in Case IE provides it with prefix. */
          filter: grayscale(0);
}

.social-icons.filter .icon-facebook {
  background-image: url("https://i.imgur.com/dBSL6N2.png"); /* Color Icon */
}

.social-icons.nofilter .icon-facebook {
  background-image: url("https://i.imgur.com/TtcsSBg.png"); /* Fallback B&W Icon*/
}

.social-icons.nofilter .icon-facebook:hover {
  background-image: url("https://i.imgur.com/dBSL6N2.png"); /* Fallback Color Icon */
}

.social-icons.filter .icon-twitter {
  background-image: url("https://i.imgur.com/C6hmtgp.png"); /* Color Icon */
}

.social-icons.nofilter .icon-twitter {
  background-image: url("https://i.imgur.com/Jm7GSTD.png"); /* Fallback B&W Icon */
}

.social-icons.nofilter .icon-twitter:hover {
  background-image: url("https://i.imgur.com/C6hmtgp.png"); /* Fallback Color Icon */
}

.social-icons.filter .icon-gplus {
  background-image: url("https://i.imgur.com/Ks4TG00.png");
}

.social-icons.nofilter .icon-gplus {
  background-image: url("https://i.imgur.com/kEEKHE0.png");
}

.social-icons.nofilter .icon-gplus:hover {
  background-image: url("https://i.imgur.com/Ks4TG00.png");
}

.social-icons.filter .icon-pintrest {
  background-image: url("https://i.imgur.com/BYJUbtI.png");
}

.social-icons.nofilter .icon-pintrest {
  background-image: url("https://i.imgur.com/eMgJzz2.png");
}

.social-icons.nofilter .icon-pintrest:hover {
  background-image: url("https://i.imgur.com/BYJUbtI.png");
}

.social-icons.filter .icon-youtube {
  background-image: url("https://i.imgur.com/ZQiLpek.png");
}

.social-icons.nofilter .icon-youtube {
  background-image: url("https://i.imgur.com/rFys3w0.png");
}

.social-icons.nofilter .icon-youtube:hover {
  background-image: url("https://i.imgur.com/ZQiLpek.png");
}

/* Switch Styles */

.container {
  margin: auto;
	height: 64px;
	width: 160px;
}

.switch {
  margin-left: 10px;
}

.switch input {
    font-family: inherit;
    font-size: 100%;
    line-height: normal;
    margin: 0;
}

.switch input[type="radio"] {
    box-sizing: border-box;
    padding: 0;
}

.switch {
	background: #fff;
	border-radius: 32px;
	display: block;
	height: 64px;
	position: relative;
	width: 160px;
}

.switch label {
	color: #444;
  font: 100%/1.5em "Lato", sans-serif;
	font-size: 48px;
	font-weight: 300;
	line-height: 64px;
	text-transform: uppercase;
	-webkit-transition: color .2s ease;
	   -moz-transition: color .2s ease;
    	-ms-transition: color .2s ease;
	     -o-transition: color .2s ease;
	        transition: color .2s ease;
	width: 100px;
}

.switch label:nth-of-type(1) {
	left: -75%;
	position: absolute;
	text-align: right;
}

.switch label:nth-of-type(2) {
	position: absolute;
  right: -75%;
	text-align: left;
}

.switch input {
	height: 64px;
	left: 0;
	opacity: 0;
	position: absolute;
	top: 0;
	width: 160px;
	z-index: 2;
}

.switch input:checked~label:nth-of-type(1) { color: #444; }
.switch input:checked~label:nth-of-type(2) { color: #808080; }

.switch input~:checked~label:nth-of-type(1) { color: #808080; }
.switch input~:checked~label:nth-of-type(2) { color: #444; }

.switch input:checked~.toggle {
	left: 4px;
}

.switch input~:checked~.toggle {
	left: 100px;
}

.switch input:checked {
	z-index: 0;
}

.toggle {
	background: #4a4a4a;
	border-radius: 50%;
	height: 56px;
	left: 0;
	position: absolute;
	top: 4px;
	-webkit-transition: left .2s ease;
	   -moz-transition: left .2s ease;
	    -ms-transition: left .2s ease;
	     -o-transition: left .2s ease;
	        transition: left .2s ease;
	width: 56px;
	z-index: 1;
}
            
          
!
            
              /**
Social Icons (CSS Filters/ No Filters).

Social icons on-hover grayscale effect with CSS3 filters applied and with no filter applied. Toggle Switch courtesy: Marco Biedermann (https://codepen.io/m412c0).

@author: Kushal Pandya (http://doublslash.com)

Following JS code is just for feature-detection and toggling filters.

**/

// Patch Modernizr to detect CSS Filters Support
Modernizr.addTest('cssfilters', function() {
    var el = document.createElement('div');
    el.style.cssText = Modernizr._prefixes.join('filter' + ':blur(2px); ');
    return !!el.style.length && ((document.documentMode === undefined || document.documentMode > 9));
});;

var socialIconsList = $("ul.social-icons");

// Check CSS Filters support
if (!Modernizr.cssfilters)
{
  $("#switch-off").prop('checked',true);
  $("#switch-on").prop('disabled', true);
  $(".error").text("Sorry! CSS Filters are not supported in your browser. We're using fallback mode.");
  socialIconsList.addClass("nofilter");
}

$("input[type='radio']").on("click", function(e) {
  if ($(this).val() === "on")
  {
    socialIconsList.removeClass("nofilter").addClass("filter");
  }
  else
  {
    socialIconsList.removeClass("filter").addClass("nofilter");
  }
});
            
          
!
999px
Loading ..................

Console