I am a newcomer to vue.js and I have a question about creating a bounding box for any element. This bounding box resembles a view box in svg
. For example, I have created a checkbox like this one: checkbox
Below is the code to style the checkbox:
/* checkbox aspect */
[type="checkbox"]:not(:checked) + label:before,
[type="checkbox"]:checked + label:before {
content: '';
position: absolute;
left: 0;
top: 0;
width: 1.4em;
height: 1.4em;
border: 1px solid #aaa;
background: #FFF;
border-radius: .2em;
box-shadow: inset 0 1px 3px rgba(0,0,0, .1), 0 0 0 rgba(203, 34, 237, .2);
-webkit-transition: all .275s;
transition: all .275s;
}
/* checked mark aspect */
[type="checkbox"]:not(:checked) + label:after,
[type="checkbox"]:checked + label:after {
content: '✕';
position: absolute;
top: .525em;
left: .18em;
font-size: 1.375em;
color: #CB22ED;
line-height: 0;
-webkit-transition: all .2s;
transition: all .2s;
}
My goal is to create a 32px bounding box for this checkbox, similar to the viewbox
in svg
. You can refer to the icon grid and guidelines here. Let's assume the centerpoint is where the checkbox should be located, within a blue rectangle as the bounding box.