<div class="inputs">
<input id="border-box" checked name="box_selectors" type="radio"/>
<label for="border-box">border-box</label>
<input id="padding-box" name="box_selectors" type="radio"/>
<label for="padding-box">padding-box</label>
<input id="content-box" name="box_selectors" type="radio"/>
<label for="content-box">content-box</label>
</div>
<div class="background-origin"></div>
@import "compass/css3";
.background-origin {
box-sizing: border-box;
height: 300px;
width: 300px;
background: url('http://lorempixel.com/300/300/cats') no-repeat;
border: 16px solid rgba(23,23,23,0.5);
background-origin: border-box;
background-size: cover;
padding: 16px;
margin: 0 auto;
}
.inputs {
text-align: center;
margin: 16px;
label {
cursor: pointer;
padding: 12px 0;
}
input {
cursor: pointer;
margin-left: 12px;
}
}
View Compiled
var $box = $('.background-origin');
$('.inputs').find('input').on('change', function() {
console.log(this);
$box.css('background-origin', $(this).attr('id'));
});
This Pen doesn't use any external CSS resources.