Why does custom CSS styling not apply due to vertical slider? - html

#slider1 {
-webkit-appearance: slider-vertical; /* This makes ... */
background-color: black;
width: 1px;
height: 100px;
}
#slider2 {
-webkit-appearance: none; /* the difference. */
background-color: black;
width: 100px;
height: 1px;
}
#slider1::-webkit-slider-thumb,
#slider2::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
background: #04aa6d;
cursor: pointer;
}
#slider1::-webkit-slider-thumb:hover,
#slider2::-webkit-slider-thumb:hover {
width: 20px;
height: 20px;
}
<input type="range" id="slider1" />
<input type="range" id="slider2" />
As seen here, the CSS styling was almost same for both sliders, except for the -webkit-appearance property. But the horizontal slider (which is the default slider) accepts the styling while the vertical slider rejects it. I am on Chrome. How to make it work? Thanks!

It seems like there is no work around available to design vertical range, what you can do is to rotate the default one.
.wrap {
display: flex;
}
.slid1 {
display: flex;
justify-content: center;
align-items: center;
height: 100px;
width: 30px;
}
#slider1,
#slider2 {
-webkit-appearance: none;
/* the difference. */
background-color: black;
width: 100px;
height: 1px;
}
#slider1 {
-webkit-appearance: none;
/* This makes ... */
transform: rotate(270deg);
transform-origin: center;
}
#slider1::-webkit-slider-thumb,
#slider2::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
background: #04aa6d;
cursor: pointer;
}
#slider1::-webkit-slider-thumb:hover,
#slider2::-webkit-slider-thumb:hover {
width: 20px;
height: 20px;
}
<div class="wrap">
<div class="slid1">
<input type="range" id="slider1" />
</div>
<div class="slid2">
<input type="range" id="slider2" />
</div>
</div>
Source
Edit: As per your comment, I have wrapped sliders into flex containers to align them.

In order to add custom styling to range slider, you need to set a css property -webkit-appearance: none; which you did in #slider2 but you missed it in #slider1.
Try the following code
<input type="range" id="slider1" />
<input type="range" id="slider2" />
<style type="text/css">
#slider1 {
-webkit-appearance: none; /* This makes ... */
background-color: black;
width: 1px;
height: 100px;
}
#slider2 {
-webkit-appearance: none; /* the difference. */
background-color: black;
width: 100px;
height: 1px;
}
#slider1::-webkit-slider-thumb,
#slider2::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
background: #04aa6d;
cursor: pointer;
}
#slider1::-webkit-slider-thumb:hover,
#slider2::-webkit-slider-thumb:hover {
width: 20px;
height: 20px;
}
</style>
Then you will find the vertical slider

/* can you please try this below CSS code along with your css */
/*Chrome*/
#media screen and (-webkit-min-device-pixel-ratio:0) {
input[type='range'] {
overflow: hidden;
width: 80px;
-webkit-appearance: none;
}
input[type='range']::-webkit-slider-runnable-track {
height: 10px;
-webkit-appearance: none;
color: #13bba4;
margin-top: -1px;
}
}

#slider1 {
margin-top: 50px;
transform: rotate(90deg);
}
#slider1, #slider2 {
-webkit-appearance: none; /* the difference. */
background-color: black;
width: 100px;
height: 1px;
}
#slider1::-webkit-slider-thumb,
#slider2::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
background: #04aa6d;
cursor: pointer;
}
#slider1::-webkit-slider-thumb:hover,
#slider2::-webkit-slider-thumb:hover {
width: 20px;
height: 20px;
}
<input type="range" id="slider1" />
<input type="range" id="slider2" />

Related

Making range slider vertical

I am trying to customize a range slider according to my need i am almost there except for the orientation of it, currently it's aligned horizontally which should be vertical.
I have tried adding
data-orientation = "vertical"
and Orient="vertical" as well as
.input-range{
writing-mode: bt-lr; /* IE */
-webkit-appearance: slider-vertical;
}
got no luck.
current code base is as follows : Style
.input-range{
writing-mode: bt-lr; /* IE */
-webkit-appearance: slider-vertical;}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.PrixMin {
float: left;
color: #164188;
font-size: 19px;
margin-right: 5px;
}
.selecteurPrix {
padding-top: 15px;
display:block;
position:absolute;
top:90px;
left:0;
z-index: 1200
}
body {
font-family: sans-serif;
padding: 40px;
}
.range-slider {
position: relative;
width: 450px;
float: left;
margin-right: 5px;
}
#media (-webkit-min-device-pixel-ratio:0) {
/* Non-IE styles here*/
.range-slider .input-range {
-webkit-appearance: none;
width: 449px;
height: 5px;
border-radius: 5px;
background: #ccc;
outline: none;
}
}
#media (-ms-high-contrast:none),(-ms-high-contrast:active) {
/* IE styles here*/
.range-slider .input-range {
/*removes default webkit styles*/
-webkit-appearance: none;
/*fix for FF unable to apply focus style bug */
border: 1px solid white;
/*required for proper track sizing in FF*/
width: 450px;
outline: none;
}
}
.range-slider .input-range::-webkit-slider-thumb {
-webkit-appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
background: #164188;
cursor: pointer;
-webkit-transition: background .15s ease-in-out;
transition: background .15s ease-in-out;
}
.range-slider .input-range::-webkit-slider-thumb:hover {
background: #164188;
}
.range-slider .input-range:active::-webkit-slider-thumb {
background: #164188;
}
.range-slider .input-range::-moz-range-thumb {
width: 20px;
height: 20px;
border: 0;
border-radius: 50%;
background: #164188;
cursor: pointer;
-webkit-transition: background .15s ease-in-out;
transition: background .15s ease-in-out;
}
.range-slider .input-range::-moz-range-thumb:hover {
background: #164188;
}
.range-slider .input-range:active::-moz-range-thumb {
background: #164188;
}
.range-slider .range-value {
display: inline-block;
position: relative;
width: 100px;
color: #fff;
font-size: 23px;
line-height: 32px;
text-align: center;
border-radius: 3px;
background: #164188;
padding: 5px 10px;
margin-left: 7px;
}
::-moz-range-track {
background: #ccc;
border: 0;
}
input::-moz-focus-inner {
border: 0;
}
input[type=range] {
margin: 2px;
}
input[type=range]::-ms-track {
width: 450px;
height: 5px;
/*remove bg colour from the track, we'll use ms-fill-lower and ms-fill-upper instead */
background: transparent;
/*leave room for the larger thumb to overflow with a transparent border */
border-color: transparent;
border-width: 6px 0;
/*remove default tick marks*/
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #ccc;
border-radius: 10px;
}
input[type=range]::-ms-fill-upper {
background: #ccc;
border-radius: 10px;
}
Markup
<div class="selecteurPrix">
<div class="PrixMin"> -100</div>
<div class="range-slider">
<input class="input-range" orient="vertical" type="range" value="0" min="-100" max="100" step="25">
</div> <div class="PrixMin"> 100</div>
</div>
Is there something i am missing here? any help would is appreciated. Thanks
2 things
#media (-webkit-min-device-pixel-ratio:0) {
/* Non-IE styles here*/
.range-slider .input-range {
-webkit-appearance: none;
width: 449px;
height: 5px;
}
}
Is overwriting your
.input-range{
writing-mode: bt-lr; /* IE */
-webkit-appearance: slider-vertical;
}
Also you need to flip the width and height to match the vetical design
.input-range{
writing-mode: bt-lr; /* IE */
-webkit-appearance: slider-vertical;
width: 5px;
height: 449px;
}
you're looking for this appearance css property:
.input-range {
appearance: slider-vertical;
-moz-appearance: slider-vertical;
-webkit-appearance: slider-vertical;
}
Add:
input[orient=vertical] {
-webkit-appearance: slider-vertical;
height: 450px;
padding: 0 20px;
width: 20px;
writing-mode: bt-lr;
}
Remove:
.range-slider {
position: relative;
width: 450px;
float: left;
margin-right: 5px;
}

need to make this below range slider Responsive

I need to make this Range slider responsive. Text is getting overlapped when i start using in mobile version. Please help me to achieve this.
I have tried to add it in Table responsive and adding some responsive divs but still it didn't workout.
It would be great if someone help me to find out the way to make it responsive. You can see executable code in
#import url(https://fonts.googleapis.com/css?family=Catamaran" rel="stylesheet);
#import url("https://fonts.googleapis.com/css?family=Dancing+Script");
.label-container {
margin-top: 0.5rem;
-webkit-flex-basis: 100%;
display: -webkit-flex;
-webkit-flex-wrap: nowrap;
-webkit-justify-content: space-between;
margin-bottom: 50px;
}
.label-slider {
color: #3949ab;
font-size: 14px;
font-weight: 700;
text-align: center;
-webkit-tap-highlight-color: transparent;
cursor: pointer;
}
.label-slider:nth-child(1) {
padding-left: 0px;
}
.label-slider:nth-child(2) {
padding-left: 18px;
}
.label-slider:nth-child(3) {
padding-left: 34px;
}
.label-slider:nth-child(4) {
padding-left: 32px;
}
.label-slider:nth-child(5) {
padding-left: 32px;
}
.slider-container {
width: 100%;
margin-top: 5px;
}
.slider {
-webkit-appearance: none;
-moz-appearance: none;
width: 100%;
height: 10px;
border-radius: 5px;
background: #dde5ff;
outline: none;
opacity: 0.7;
-webkit-transition: 0.2s;
transition: opacity 0.2s;
}
input[type="range"],
input[type="range"]::-moz-range-track {
-webkit-appearance: none;
-moz-appearance: none;
width: 100%;
border-radius: 5px;
background: #dde5ff;
outline: none;
transition: opacity 0.2s;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
border-radius: 50%;
background: #2b8aeb;
cursor: pointer;
outline: none;
}
input[type="range"]::-moz-range-thumb {
-moz-appearance: none;
appearance: none;
width: 25px;
height: 25px;
border-radius: 50%;
background: #1492ea;
cursor: pointer;
outline: none;
z-index: 10;
}
input[type="range"]:focus {
outline: none;
}
<body>
<p class="title">Range Sliders</p>
<h4>Range Slider without steps</h4>
<div class="slider-container">
<input type="range" min="0" max="4" class="slider">
</div>
<div class="label-container">
<div class="label-slider">None</div>
<div class="label-slider">1</div>
<div class="label-slider">2</div>
<div class="label-slider">3</div>
<div class="label-slider">4+</div>
</div>
</body>
Just replace width: 600px by max-width:600px; in container.
For the font-size, I would recommand you to set font size based in rem. and set breakpoints font-size on your html element to size as you wish. as this subject: Rem not compatible with media queries?
Ad I will also recommand you to remove container padding-left and right when you under a certain width of screen, this way, the scale will stay well align with your input.
Edit
To fix the the container label, I set them with position absolute.
First step add position relative on container:
.label-container{
position:relative;
}
Then add position: absolute on labels:
.label-slider{
position: absolute;
}
And finaly just Adjust correctly with absolute as follow:
.label-slider:nth-child(1) {
left:0;
}
.label-slider:nth-child(2) {
left:25%;
transform: translateX(-25%);
margin-left: 1%;
}
.label-slider:nth-child(3) {
left:50%;
transform: translateX(-50%);
margin-left: .5%;
}
.label-slider:nth-child(4) {
right: 25%;
transform: translateX(25%);
margin-left: 1%;
}
.label-slider:nth-child(5) {
right:0;
}
DEMO FULL
#import url(https://fonts.googleapis.com/css?family=Catamaran" rel="stylesheet);
#import url("https://fonts.googleapis.com/css?family=Dancing+Script");
body {
font-family: "Catamaran", sans-serif;
background: #2b8aeb;
}
.container {
font-family: "Catamaran", sans-serif;
max-width: 600px;
margin: 30px auto 0;
display: block;
background: #fff;
padding: 10px 50px 50px;
border-radius: 4px;
box-shadow 0 6px 16px rgba(0,0,0,0.15)
}
.title {
text-align: center;
font-family: "Dancing Script", cursive;
color: #3949ab;
font-size: 35px;
}
.label-container {
margin-top: 0.5rem;
-webkit-flex-basis: 100%;
display: -webkit-flex;
-webkit-flex-wrap: nowrap;
-webkit-justify-content: space-between;
margin-bottom: 50px;
position : relative;
}
.label-slider {
color: #3949ab;
font-size: 14px;
font-weight: 700;
text-align: center;
-webkit-tap-highlight-color: transparent;
cursor: pointer;
position: absolute;
}
.label-slider:nth-child(1) {
left:0;
}
.label-slider:nth-child(2) {
left:25%;
transform: translateX(-25%);
margin-left: 1%;
}
.label-slider:nth-child(3) {
left:50%;
transform: translateX(-50%);
margin-left: .5%;
}
.label-slider:nth-child(4) {
right: 25%;
transform: translateX(25%);
margin-left: 1%;
}
.label-slider:nth-child(5) {
right:0;
}
.slider-container {
width: 100%;
margin-top: 5px;
}
.slider {
-webkit-appearance: none;
-moz-appearance: none;
width: 100%;
height: 10px;
border-radius: 5px;
background: #dde5ff;
outline: none;
opacity: 0.7;
-webkit-transition: 0.2s;
transition: opacity 0.2s;
}
input[type="range"],
input[type="range"]::-moz-range-track {
-webkit-appearance: none;
-moz-appearance: none;
width: 100%;
border-radius: 5px;
background: #dde5ff;
outline: none;
transition: opacity 0.2s;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
border-radius: 50%;
background: #2b8aeb;
cursor: pointer;
outline: none;
}
input[type="range"]::-moz-range-thumb {
-moz-appearance: none;
appearance: none;
width: 25px;
height: 25px;
border-radius: 50%;
background: #1492ea;
cursor: pointer;
outline: none;
z-index: 10;
}
input[type="range"]:focus {
outline: none;
}
.ticks {
font-family: "Catamaran", sans-serif;
color: #3949ab;
font-size: 14px;
font-weight: 700;
display: flex;
justify-content: space-between;
height: 6px;
margin: 0 10px 0 15px;
counter-reset: count -1;
}
.ticks > div {
height: 100%;
width: 1px;
background: silver;
counter-increment: count 1;
}
.ticks > div:nth-child(5n - 4) {
height: 200%;
}
.ticks > div:nth-child(5n - 4)::before {
display: block;
content: counter(count,decimal);
transform: translate(-50%, 100%);
text-align: center;
width: 16px;
}
<body>
<div class="container">
<p class="title">Range Sliders</p>
<h4>Range Slider without steps</h4>
<div class="slider-container">
<input type="range" min="0" max="4" class="slider">
</div>
<div class="label-container">
<div class="label-slider">None</div>
<div class="label-slider">1</div>
<div class="label-slider">2</div>
<div class="label-slider">3</div>
<div class="label-slider">4+</div>
</div>
</div>
</body>

How do I get the slider hover to be a circle and also get rid of the line that forms above the slider?

I currently have a slider with a hover, but is there a way to make the hover a circle that will appear as a circle in all browsers? Is there also a way to change the shape of the slider from a rectangle to a line? I have also tried to remove the random line that appears above the slider but can't seem to remove it, is there something obvious that I am missing?
Thank you!
#container {
padding: 300px 500px;
}
#frequencySlider {
margin-top: 1px;
width: 100%;
}
#frequencyLabel {
margin-top: 1px;
}
#toggleAudio {
padding: 10px 20px;
height: center;
width: center;
font-size: 15px;
background: #939393;
color: white;
opacity: 0.7;
}
/* Slider */
.slider {
-webkit-appearance: none;
appearance: none;
width: 100%;
height: 8px;
background: #908e8e;
opacity: 0.2;
-webkit-transition: .3s;
transition: opacity .3s;
}
.slider:hover {}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 12px;
height: 20px;
background: #0b38b4;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 12px;
height: 20px;
background: #0b38b4;
cursor: pointer;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div id="container">
<button id="toggleAudio">
Click Here
</button>
<hr>
<input type="range" min="100" max="4000" value="2000" step="1" class="slider" id="frequencySlider">
<br>
<p id="frequencyLabel">Frequency: 2000 Hz</p>
</div>
</body>
</html>
Also works in IE11 -> full example
#frequencySlider {
margin-top: 1px;
width: 100%;
}
#frequencyLabel {
margin-top: 1px;
}
#toggleAudio {
padding: 10px 20px;
height: center;
width: center;
font-size: 15px;
background: #939393;
color: white;
opacity: 0.7;
}
/* Slider */
input[type=range] {
width: 100%;
height: 25px;
margin: 10px 0;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background: transparent;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-moz-range-track {
width: 100%;
height: 5px;
cursor: pointer;
background: #f00;
border-radius: 1px;
border: 0px solid #000;
color: transparent;
}
input[type=range]::-ms-track {
width: 100%;
height: 5px;
cursor: pointer;
background: #f00;
border-radius: 1px;
border: 0px solid #000;
color: transparent;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 5px;
cursor: pointer;
background: #f00;
border-radius: 1px;
border: 0px solid #000;
color: transparent;
}
input[type=range]::-moz-range-thumb {
border: 1px solid #000;
height: 18px;
width: 18px;
border-radius: 50%;
background: rgb(33, 150, 243);
cursor: pointer;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin-top: -7px;
}
input[type=range]::-ms-thumb {
border: 1px solid #000;
height: 18px;
width: 18px;
border-radius: 50%;
background: rgb(33, 150, 243);
cursor: pointer;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin-top: -7px;
}
input[type=range]::-webkit-slider-thumb {
border: 1px solid #000;
height: 18px;
width: 18px;
border-radius: 50%;
background: rgb(33, 150, 243);
cursor: pointer;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin-top: -7px;
}
/* fix for IE11 */
input[type=range]::-ms-thumb {
height: 15px;
width: 15px;
margin-top: 0;
background: rgb(33, 150, 243);
}
<div id="container">
<button id="toggleAudio">
Click Here
</button>
<label id="range" class="range">
<input type="range" min="100" max="4000" value="2000" step="1" id="frequencySlider">
</label>
<br>
<p id="frequencyLabel">Frequency: 2000 Hz</p>
</div>

How to display a text and a slider in one line in HTML / CSS?

I have the following two elements: a caption and a slider that I want to be displayed in one line, but I don't manage to do that.
What could I fix?
Thanks!
#biasindex {
position: fixed;
bottom: 40px;
width: 100px;
height: 15px;
right: 200px; /* "#menu width" */
font-size: 14px; /* change this value to increase/decrease button size */
/* width: 2em;
height: auto;*/
z-index: 10;
float: left;
}
.slidercaption {
display: inline-block;
float: left;
}
.slidecontainer {
width: 100%;
float: left;
display: inline-block;
}
.slider {
-webkit-appearance: none;
width: 100%;
height: 25px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
display: inline-block;
float: left;
}
.slider:hover {
opacity: 1;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
background: #4CAF50;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 25px;
height: 25px;
background: #4CAF50;
cursor: pointer;
}
<div id="biasindex"><div class="slidercaption">bias index: </div><div class="slidercontainer"><input type="range" min="1" max="100" value="50" class="slider" id="biasRange">
</div></div>
Use dispaly:flex to wrap element.
Also use .slidercontainer in css instead .slidecontainer
#biasindex{
display:flex;
}
.slidercaption {
display: inline-block;
float: left;
}
.slidercontainer{
width: 100%;
float: left;
display: inline-block;
}
.slider {
-webkit-appearance: none;
width: 100%;
height: 25px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
display: inline-block;
float: left;
}
.slider:hover {
opacity: 1;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
background: #4CAF50;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 25px;
height: 25px;
background: #4CAF50;
cursor: pointer;
}
<div id="biasindex">
<div class="slidercaption">bias index: </div>
<div class="slidercontainer"><input type="range" min="1" max="100" value="50" class="slider" id="biasRange">
</div>
</div>
Use flexbox. Remove float and add display flex
Below is the modified code
#biasindex {
position: fixed;
bottom: 40px;
width: 100px;
height: 15px;
right: 200px; /* "#menu width" */
font-size: 14px; /* change this value to increase/decrease button size */
/* width: 2em;
height: auto;*/
z-index: 10;
/*float: left;*/
display: flex;
}
.slidercaption {
display: inline-block;
float: left;
}
.slidecontainer {
width: 100%;
float: left;
display: inline-block;
}
.slider {
-webkit-appearance: none;
width: 100%;
height: 25px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
display: inline-block;
float: left;
}
.slider:hover {
opacity: 1;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
background: #4CAF50;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 25px;
height: 25px;
background: #4CAF50;
cursor: pointer;
}

How to change Checkbox UI Using Html and CSS?

<input type='checkbox' name='chkbox'/>
I want to change the checkbox height and width and also background color if possible
You can look at this piece of code for starters.
It uses the before element to create a custom shape and hide the default checkbox for two states 'checked' and 'unchecked'
Also give a label for that corresponding checkbox so that clicking this custom shape will actually trigger the hidden default checkbox.
body {
font-family: 'segoe ui';
background-color: white;
padding: 10px;
}
.space {
height: 10px;
}
.checkbox * {
box-sizing: border-box;
position: relative;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.checkbox {
display: inline-block;
}
.checkbox>input {
display: none;
}
.checkbox>label {
vertical-align: top;
font-size: 18px;
padding-left: 30px;
}
.checkbox>[type="checkbox"]+label:before {
color: #777;
content: '';
position: absolute;
left: 0px;
display: inline-block;
min-height: 20px;
height: 20px;
width: 20px;
border: 2px solid #777;
font-size: 15px;
vertical-align: top;
text-align: center;
transition: all 0.2s ease-in;
content: '';
}
.checkbox.radio-square>[type="checkbox"]+label:before {
border-radius: 0px;
}
.checkbox.radio-rounded>[type="checkbox"]+label:before {
border-radius: 25%;
}
.checkbox.radio-blue>[type="checkbox"]+label:before {
border: 2px solid #ccc;
}
.checkbox>[type="checkbox"]+label:hover:before {
border-color: lightgreen;
}
.checkbox>[type="checkbox"]:checked+label:before {
width: 8px;
height: 16px;
border-top: transparent;
border-left: transparent;
border-color: green;
border-width: 4px;
transform: rotate(45deg);
top: -4px;
left: 4px;
}
<div class="checkbox">
<input id="chkTest" type="checkbox" />
<label for="chkTest">Task one</label>
<div class="space">
</div>
<input id="chkTest1" type="checkbox" />
<label for="chkTest1">Task two</label>
</div>