Skip to content

Instantly share code, notes, and snippets.

@samarkandiy
Created October 6, 2012 07:04
Show Gist options
  • Save samarkandiy/3844260 to your computer and use it in GitHub Desktop.
Save samarkandiy/3844260 to your computer and use it in GitHub Desktop.
work on progress...
<div class="preview">
<input checked class='red' name='color' type='radio' />
<input class='green' name='color' type='radio' />
<input class='yellow' name='color' type='radio' />
<input class='purple' name='color' type='radio' />
<img src="http://iweb.uz/azik/wp-content/uploads/2012/10/tshirta.png"/>
</div>
body{
background: #333 url(/images/classy_fabric.png);
width: 400px;
margin: 0 auto;
padding: 30px;
}
.preview{
background: #ccc;
width: 415px;
height: 430px;
border: solid 10px #fff;
}
input[type='radio'] {
-webkit-appearance: none;
-moz-appearance: none;
width: 25px;
height: 25px;
margin: 5px 0 5px 5px;
background-size: 225px 70px;
position: relative;
float: left;
display: inline;
top: 0;
border-radius: 3px;
z-index: 99999;
cursor: pointer;
box-shadow: 1px 1px 1px #000;
}
input[type='radio']:hover{
background: linear-gradient(#fff, #ccc);
}
.red{
background: red;
}
.red:checked{
background: linear-gradient(brown, red)
}
.green{
background: green;
}
.green:checked{
background: linear-gradient(green, lime);
}
.yellow{
background: yellow;
}
.yellow:checked{
background: linear-gradient(orange, yellow);
}
.purple{
background: purple;
}
.purple:checked{
background: linear-gradient(purple, violet);
}
.red:checked ~ img{
-webkit-filter: opacity(.5) drop-shadow(0 0 0 red);
}
.green:checked ~ img{
-webkit-filter: opacity(.5) drop-shadow(0 0 0 green);
}
.yellow:checked ~ img{
-webkit-filter: opacity(.5) drop-shadow(0 0 0 yellow);
}
.purple:checked ~ img{
-webkit-filter: opacity(.5) drop-shadow(0 0 0 purple);
}
img{
width: 394px;
height: 375px;
position: relative;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment