Input range with split colors using CSS - html

Is it possible to restyle a input range to have different colors on the right and left side of the tracker just by CSS? This is what i have gotten so far.
input[type=range] {
margin: 10px 0;
margin: 50px;
width: 500px;
background: transparent;
-webkit-appearance: none;
}
input[type=range]::-webkit-slider-runnable-track {
height: 10px;
background: white;
border-radius: 5px;
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
border: none;
height: 25px;
width: 25px;
border-radius: 50%;
background: white;
border: 3px green solid;
margin-top: -7px;
}
input[type=range]:focus {
outline: none;
}
body {
background-color: green;
}
<input type="range" min="0" max="10" />
https://jsfiddle.net/Lautaro/k179gwur/1/

Yeah, you could use css gradient.
input[type=range]::-webkit-slider-runnable-track {
background: linear-gradient(to right, #000000 0%,#000000 50%,#ffffff 50%,#ffffff 100%,#ffffff 100%);
}

As far as I know it is not possible to do using only CSS.
Alternatively you can easily accomplish it with a tiny bit of javascript.
Use this: https://toughengineer.github.io/demo/slider-styler
for (let e of document.querySelectorAll('input[type="range"].slider-progress')) {
e.style.setProperty('--value', e.value);
e.style.setProperty('--min', e.min == '' ? '0' : e.min);
e.style.setProperty('--max', e.max == '' ? '100' : e.max);
e.addEventListener('input', () => e.style.setProperty('--value', e.value));
}
/*surrounding background color*/
body {
background: green;
}
/*generated with Input range slider CSS style generator (version 20201223)
https://toughengineer.github.io/demo/slider-styler*/
input[type=range].styled-slider {
height: 2.2em;
-webkit-appearance: none;
/*added this property to generated CSS to match the surrounding background color*/
background: transparent;
/*specify desired width*/
width: 500px;
}
/*progress support*/
input[type=range].styled-slider.slider-progress {
--range: calc(var(--max) - var(--min));
--ratio: calc((var(--value) - var(--min)) / var(--range));
--sx: calc(0.5 * 2em + var(--ratio) * (100% - 2em));
}
input[type=range].styled-slider:focus {
outline: none;
}
/*webkit*/
input[type=range].styled-slider::-webkit-slider-thumb {
width: 2em;
height: 2em;
border-radius: 1em;
background: #007cf8;
border: none;
box-shadow: 0 0 2px black;
margin-top: calc(max((1em - 1px - 1px) * 0.5,0px) - 2em * 0.5);
-webkit-appearance: none;
}
input[type=range].styled-slider::-webkit-slider-runnable-track {
height: 1em;
border-radius: 0.5em;
background: #efefef;
border: 1px solid #b2b2b2;
box-shadow: none;
}
input[type=range].styled-slider::-webkit-slider-thumb:hover {
background: #0061c3;
}
input[type=range].styled-slider:hover::-webkit-slider-runnable-track {
background: #e5e5e5;
border-color: #9a9a9a;
}
input[type=range].styled-slider::-webkit-slider-thumb:active {
background: #2f98f9;
}
input[type=range].styled-slider:active::-webkit-slider-runnable-track {
background: #f5f5f5;
border-color: #c1c1c1;
}
input[type=range].styled-slider.slider-progress::-webkit-slider-runnable-track {
background: linear-gradient(#007cf8,#007cf8) 0/var(--sx) 100% no-repeat, #efefef;
}
input[type=range].styled-slider.slider-progress:hover::-webkit-slider-runnable-track {
background: linear-gradient(#0061c3,#0061c3) 0/var(--sx) 100% no-repeat, #e5e5e5;
}
input[type=range].styled-slider.slider-progress:active::-webkit-slider-runnable-track {
background: linear-gradient(#2f98f9,#2f98f9) 0/var(--sx) 100% no-repeat, #f5f5f5;
}
/*mozilla*/
input[type=range].styled-slider::-moz-range-thumb {
width: 2em;
height: 2em;
border-radius: 1em;
background: #007cf8;
border: none;
box-shadow: 0 0 2px black;
}
input[type=range].styled-slider::-moz-range-track {
height: max(calc(1em - 1px - 1px),0px);
border-radius: 0.5em;
background: #efefef;
border: 1px solid #b2b2b2;
box-shadow: none;
}
input[type=range].styled-slider::-moz-range-thumb:hover {
background: #0061c3;
}
input[type=range].styled-slider:hover::-moz-range-track {
background: #e5e5e5;
border-color: #9a9a9a;
}
input[type=range].styled-slider::-moz-range-thumb:active {
background: #2f98f9;
}
input[type=range].styled-slider:active::-moz-range-track {
background: #f5f5f5;
border-color: #c1c1c1;
}
input[type=range].styled-slider.slider-progress::-moz-range-track {
background: linear-gradient(#007cf8,#007cf8) 0/var(--sx) 100% no-repeat, #efefef;
}
input[type=range].styled-slider.slider-progress:hover::-moz-range-track {
background: linear-gradient(#0061c3,#0061c3) 0/var(--sx) 100% no-repeat, #e5e5e5;
}
input[type=range].styled-slider.slider-progress:active::-moz-range-track {
background: linear-gradient(#2f98f9,#2f98f9) 0/var(--sx) 100% no-repeat, #f5f5f5;
}
/*ms*/
input[type=range].styled-slider::-ms-fill-upper {
background: transparent;
border-color: transparent;
}
input[type=range].styled-slider::-ms-fill-lower {
background: transparent;
border-color: transparent;
}
input[type=range].styled-slider::-ms-thumb {
width: 2em;
height: 2em;
border-radius: 1em;
background: #007cf8;
border: none;
box-shadow: 0 0 2px black;
margin-top: 0;
box-sizing: border-box;
}
input[type=range].styled-slider::-ms-track {
height: 1em;
border-radius: 0.5em;
background: #efefef;
border: 1px solid #b2b2b2;
box-shadow: none;
box-sizing: border-box;
}
input[type=range].styled-slider::-ms-thumb:hover {
background: #0061c3;
}
input[type=range].styled-slider:hover::-ms-track {
background: #e5e5e5;
border-color: #9a9a9a;
}
input[type=range].styled-slider::-ms-thumb:active {
background: #2f98f9;
}
input[type=range].styled-slider:active::-ms-track {
background: #f5f5f5;
border-color: #c1c1c1;
}
input[type=range].styled-slider.slider-progress::-ms-fill-lower {
height: max(calc(1em - 1px - 1px),0px);
border-radius: 0.5em 0 0 0.5em;
margin: -1px 0 -1px -1px;
background: #007cf8;
border: 1px solid #b2b2b2;
border-right-width: 0;
}
input[type=range].styled-slider.slider-progress:hover::-ms-fill-lower {
background: #0061c3;
border-color: #9a9a9a;
}
input[type=range].styled-slider.slider-progress:active::-ms-fill-lower {
background: #2f98f9;
border-color: #c1c1c1;
}
<input type="range" class="styled-slider slider-progress" />

Related

How to make div elements inside a div background image responsive using css

My question is this how do I make it work that the elements that are inside a div style=background-image work correctly when the screen gets smaller. In my case it seems that one of the elements inside the image box keeps the same height.
#main_article_box {
width: 728px;
height: 374px;
border: 1px solid #f8f8f8;
-moz-box-shadow: 0 2px 1px #9c9c9c;
-webkit-box-shadow: 0 2px 1px #9c9c9c;
box-shadow: 0 2px 1px #9c9c9c;
}
#main_article_text {
margin: 280px 3px 10px 3px;
height: 90px;
background: #ffffff;
border: 1px solid #f8f8f8;
background: #ffffff;
background: -moz-linear-gradient(#ffffff, #cccccc);
background: -webkit-gradient(linear, left bottom, left top, color-stop(0, #cccccc), color-stop(1, #ffffff));
background: -webkit-linear-gradient(#ffffff, #cccccc);
background: -o-linear-gradient(#ffffff, #cccccc);
background: -ms-linear-gradient(#ffffff, #cccccc);
background: linear-gradient(#ffffff, #cccccc);
/*-moz-border-radius: 1px;
border-radius: 1px;
-moz-box-shadow: 0 1px 1px #f8f8f8;
-webkit-box-shadow: 0 1px 1px #f8f8f8;
box-shadow: 0 1px 1px #f8f8f8;*/
opacity: 0.8;
filter: alpha(opacity=80);
}
#main_article_title {
font-size: 23px;
letter-spacing: -1px;
text-transform: uppercase;
text-shadow: #333;
font-weight: bold;
margin: 8px;
}
#main_article_short_text {
font-size: 14px;
width: 530px;
font-weight: bold;
margin: -2px 0 0 8px;
color: #333333;
}
#media only screen and (max-width: 460px) {
#main_article_box {
width: 100%;
height: auto;
}
#main_article_text {
width: 98%;
height: auto;
}
#main_article_title {
font-size: 16px;
}
#main_article_short_text {
font-size: 11px;
}
}
<div id="main_article_box" style="background-image: url(http://www.watchathletics.com/data/headline/9718/rio%20usain%20bolt.jpg); no-repeat center; background-size: 100% auto; ">
<div id="main_article_text">
<div id="main_article_title">Main Article Title for this post
</div>
<div id="main_article_short_text">
<p>This is some intro text the article below title. This is some intro text the article below title.</p>...
</div>
</div>
</div>
I removed some styles only for me to understand the code. Is this solution correct for you?
.wrapper {
position:relative;
width:728px;
max-width:100%;
}
.wrapper:after {
content: ' ';
clear: both;
display: block;
}
#main_article_box {
float:left;
width:100%;
height:auto;
border:0 none;
padding-top:51.37%;
background-size:cover;
}
#main_article_text {
position: absolute;
left: 0;
right: 0;
bottom: 0;
margin: 0 3px 3px 3px;
height: 90px;
background: #ffffff;
border: 1px solid #f8f8f8;
background: #ffffff;
background: -moz-linear-gradient(#ffffff, #cccccc);
background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #cccccc),color-stop(1, #ffffff));
background: -webkit-linear-gradient(#ffffff, #cccccc);
background: -o-linear-gradient(#ffffff, #cccccc);
background: -ms-linear-gradient(#ffffff, #cccccc);
background: linear-gradient(#ffffff, #cccccc);
/*-moz-border-radius: 1px;
border-radius: 1px;
-moz-box-shadow: 0 1px 1px #f8f8f8;
-webkit-box-shadow: 0 1px 1px #f8f8f8;
box-shadow: 0 1px 1px #f8f8f8;*/
opacity:0.8;
filter:alpha(opacity=80);
}
#main_article_title {
font-size: 23px;
letter-spacing: -1px;
text-transform:uppercase;
text-shadow: #333;
font-weight: bold;
margin: 8px;
}
#main_article_short_text {
font-size: 14px;
width: auto;
font-weight:bold;
margin: -2px 0 0 8px;
color: #333333;
}
#media only screen and (max-width: 460px) {
#main_article_box {
width: 100%;
height: auto;
}
#main_article_text {
width: 98%;
height: auto;
}
#main_article_title {
font-size: 16px;
}
#main_article_short_text {
font-size: 11px;
}
}
<div class="wrapper">
<div id="main_article_box" style="background-image: url(http://www.watchathletics.com/data/headline/9718/rio%20usain%20bolt.jpg);">
<div id="main_article_text">
<div id="main_article_title">Main Article Title for this post</div>
<div id="main_article_short_text"><p>This is some intro text the article below title. This is some intro text the article below title. </p>...</div>
</div>
</div>
</div>

css hover background-color not working when gradient exists

If I leave out the 5 background-image gradient lines (below), button color successfully changes on hover. But if I leave them in, shadow continues to work on hover but not the background-color. Any ideas?
.buttonlink:link, .buttonlink:visited {
background-color: #557fff; /* For browsers that do not support gradients */
background-image: -moz-linear-gradient(top,#08c,#04c); /* Firefox 3.6-15*/
background-image: -webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));
background-image: -webkit-linear-gradient(top,#08c,#04c); /* For Chrome 25 and Safari 6, iOS 6.1, Android 4.3 */
background-image: -o-linear-gradient(top,#08c,#04c); /* Opera 11.1-12 */
background-image: linear-gradient(to bottom,#08c,#04c); /* Standard, must be last */
color: white;
width:125px;
height:25px;
text-align: center;
text-decoration: none;
text-shadow: 0 -1px 0 rgba(0,0,0,0.25);
display: inline-block;
border: 2px solid #0055ff;
border-radius: 5px;
}
.buttonlink:hover, .buttonlink:active {
background-color: #E2AD27;
box-shadow: 5px 5px 5px #888888;
}
MassDebates kindly created an example that works. I also created an example in jsfiddle and that works too. Is something else in my css file overriding it? Here is the full css:
body {
height: 100%;
line-height: 25px;
font-size: 13px;
}
.infoReset {
border-width: 1px;
border-style: solid;
border-color: #858585;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
background-color: #FFFFFF;
/**behavior: url(PIE.htc);**/
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
-pie-poll: true;
position: relative;
width: 250px;
}
.auditLogSearch {
border-width: 1px;
border-style: solid;
border-color: #858585;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
background-color: #FFFFFF;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;
-pie-poll: true;
position: relative;
width: 100px;
}
#FromDatePicker, #ToDatePicker {
width: 75px;
}
input[type="text"]:FOCUS,input[type="password"]:FOCUS,select:FOCUS,textarea:FOCUS {
border: 1px solid #52A8EC !important;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px
rgba(82, 168, 236, 0.6);
outline: 0 none;
/**behavior: url(PIE.htc);**/
-pie-poll: true;
position: relative;
}
input[textarea] {
resize: none;
}
#page-wrapper {
width: 800px;
min-width: 800px;
min-height: 500px;
clear: both;
margin: 0 auto;
}
#audit-wrapper {
width: 1000px;
min-width: 1000px;
min-height: 500px;
clear: both;
margin: 0 auto;
}
hr {
border: 2px solid #000;
}
.hidden {
display: none;
}
#auditTable {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 70%;
}
#auditTable td, #auditTable th {
border: 1px solid #ddd;
text-align: left;
padding: 3px;
}
#auditTable tr:nth-child(even){background-color: #f2f2f2}
#auditTable tr:hover {background-color: #ddd;}
#auditTable th {
padding-top: 8px;
padding-bottom: 8px;
background-color: #4CAF50;
color: white;
}
.buttonlink:link, .buttonlink:visited {
background-color: #557fff; /* For browsers that do not support gradients */
background-image: -moz-linear-gradient(top,#08c,#04c); /* Firefox 3.6-15*/
background-image: -webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));
background-image: -webkit-linear-gradient(top,#08c,#04c); /* For Chrome 25 and Safari 6, iOS 6.1, Android 4.3 */
background-image: -o-linear-gradient(top,#08c,#04c); /* Opera 11.1-12 */
background-image: linear-gradient(to bottom,#08c,#04c); /* Standard, must be last */
color: white;
width:125px;
height:25px;
text-align: center;
text-decoration: none;
text-shadow: 0 -1px 0 rgba(0,0,0,0.25);
display: inline-block;
border: 2px solid #0055ff;
border-radius: 5px;
}
.buttonlink:hover, .buttonlink:active {
background-image: -moz-none;
background-image: -webkit-none;
background-image: -webkit-none;
background-image: -o-none;
background-image:none;
background-color: #E2AD27;
box-shadow: 5px 5px 5px #888888;
}
h2 {
color: #5F489D;
}
Your CSS has no rules to override the previously-set background-image styles. Please consider the following:
.buttonlink:hover, .buttonlink:active {
background-image: -moz-none;
background-image: -webkit-none;
background-image: -webkit-none;
background-image: -o-none;
background-image:none;
background-color: #E2AD27;
box-shadow: 5px 5px 5px #888888;
}
Here's a demo to show you a live example:
http://codepen.io/anon/pen/kXZwdX
This is the simplest, less amount of lines, and easiest solution to your problem:
.buttonlink:hover, .buttonlink:active {
background: #E2AD27;
}

CSS: Styling range input?

I'm trying to style a range input to look like THIS
I have no idea how to style a range input to use own image as the thumb and make the line under the thumb thicker and bigger.
I did put a very basic example in this FIDDLE
Is it even possible to use own image for the range thumb and how would i go about making the line thicker and longer etc?
This is my CSS:
input[type=range] {
-webkit-appearance: none;
background-color: blue;
width: 200px;
height:20px;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
background-color: #666;
opacity: 0.5;
width: 10px;
height: 26px;
background-image:url('THUMB-ICON.png');
}
Any advise would be appreciated.
Getting somewhere I think: https://jsfiddle.net/BNm8j/5586/
Edit:
I made some changes to this but I don't know why the top of the thumb is missing?
https://jsfiddle.net/BNm8j/5588/
any ideas anyone?
here is the original CSS of the example link:
<div id="DIV_1">
<div id="DIV_2">
</div><a id="A_3"></a>
</div>
hope this helps you.
enter code here
#DIV_1 {
box-sizing: border-box;
color: rgb(92, 92, 92);
float: left;
height: 11px;
overflow-wrap: break-word;
position: relative;
touch-action: none;
width: 705px;
word-wrap: break-word;
column-rule-color: rgb(92, 92, 92);
perspective-origin: 352.5px 5.5px;
transform-origin: 352.5px 5.5px;
background: rgb(222, 222, 222) none repeat scroll 0% 0% / auto padding-box border-box;
border: 0px none rgb(92, 92, 92);
border-radius: 3px 3px 3px 3px;
font: normal normal normal normal 16px / normal Omnes, sans-serif;
margin: 11px 30px 0px;
outline: rgb(92, 92, 92) none 0px;
}/*#DIV_1*/
#DIV_2 {
box-sizing: border-box;
color: rgb(92, 92, 92);
height: 11px;
overflow-wrap: break-word;
position: absolute;
top: 0px;
width: 122px;
word-wrap: break-word;
column-rule-color: rgb(92, 92, 92);
perspective-origin: 61px 5.5px;
transform-origin: 61px 5.5px;
background: rgb(0, 143, 213) none repeat scroll 0% 0% / auto padding-box border-box;
border: 0px none rgb(92, 92, 92);
border-radius: 3px 3px 3px 3px;
font: normal normal normal normal 16px / normal Omnes, sans-serif;
outline: rgb(92, 92, 92) none 0px;
}/*#DIV_2*/
#A_3 {
background-position: -65px 0px;
box-sizing: border-box;
color: rgb(247, 144, 47);
cursor: default;
display: block;
height: 59px;
left: 155px;
overflow-wrap: break-word;
position: absolute;
text-decoration: none;
top: -22px;
touch-action: none;
width: 58px;
word-wrap: break-word;
z-index: 100;
column-rule-color: rgb(247, 144, 47);
perspective-origin: 29px 29.5px;
transform-origin: 29px 29.5px;
background: rgba(0, 0, 0, 0) url("https://www.wonga.com/sites/all/themes/pizaz/images/mint/toolkit.png?v=2.2") no-repeat scroll -65px 0px / auto padding-box border-box;
border: 0px none rgb(247, 144, 47);
font: normal normal normal normal 16px / normal Omnes, sans-serif;
margin: 0px 0px 0px -62px;
outline: rgb(247, 144, 47) none 0px;
}/*#A_3*/
Here is a (hopefully) very ease to use tool to customize the style of <input> range:
https://toughengineer.github.io/demo/slider-styler
Here is an example:
for (let e of document.querySelectorAll('input[type="range"].slider-progress')) {
e.style.setProperty('--value', e.value);
e.style.setProperty('--min', e.min == '' ? '0' : e.min);
e.style.setProperty('--max', e.max == '' ? '100' : e.max);
e.addEventListener('input', () => e.style.setProperty('--value', e.value));
}
/*generated with Input range slider CSS style generator (version 20201223)
https://toughengineer.github.io/demo/slider-styler*/
input[type=range].styled-slider {
height: 2.2em;
-webkit-appearance: none;
}
/*progress support*/
input[type=range].styled-slider.slider-progress {
--range: calc(var(--max) - var(--min));
--ratio: calc((var(--value) - var(--min)) / var(--range));
--sx: calc(0.5 * 2em + var(--ratio) * (100% - 2em));
}
input[type=range].styled-slider:focus {
outline: none;
}
/*webkit*/
input[type=range].styled-slider::-webkit-slider-thumb {
width: 2em;
height: 2em;
border-radius: 1em;
background: #007cf8;
border: none;
box-shadow: 0 0 2px black;
margin-top: calc(max((1em - 1px - 1px) * 0.5,0px) - 2em * 0.5);
-webkit-appearance: none;
}
input[type=range].styled-slider::-webkit-slider-runnable-track {
height: 1em;
border-radius: 0.5em;
background: #efefef;
border: 1px solid #b2b2b2;
box-shadow: none;
}
input[type=range].styled-slider::-webkit-slider-thumb:hover {
background: #0061c3;
}
input[type=range].styled-slider:hover::-webkit-slider-runnable-track {
background: #e5e5e5;
border-color: #9a9a9a;
}
input[type=range].styled-slider::-webkit-slider-thumb:active {
background: #2f98f9;
}
input[type=range].styled-slider:active::-webkit-slider-runnable-track {
background: #f5f5f5;
border-color: #c1c1c1;
}
input[type=range].styled-slider.slider-progress::-webkit-slider-runnable-track {
background: linear-gradient(#007cf8,#007cf8) 0/var(--sx) 100% no-repeat, #efefef;
}
input[type=range].styled-slider.slider-progress:hover::-webkit-slider-runnable-track {
background: linear-gradient(#0061c3,#0061c3) 0/var(--sx) 100% no-repeat, #e5e5e5;
}
input[type=range].styled-slider.slider-progress:active::-webkit-slider-runnable-track {
background: linear-gradient(#2f98f9,#2f98f9) 0/var(--sx) 100% no-repeat, #f5f5f5;
}
/*mozilla*/
input[type=range].styled-slider::-moz-range-thumb {
width: 2em;
height: 2em;
border-radius: 1em;
background: #007cf8;
border: none;
box-shadow: 0 0 2px black;
}
input[type=range].styled-slider::-moz-range-track {
height: max(calc(1em - 1px - 1px),0px);
border-radius: 0.5em;
background: #efefef;
border: 1px solid #b2b2b2;
box-shadow: none;
}
input[type=range].styled-slider::-moz-range-thumb:hover {
background: #0061c3;
}
input[type=range].styled-slider:hover::-moz-range-track {
background: #e5e5e5;
border-color: #9a9a9a;
}
input[type=range].styled-slider::-moz-range-thumb:active {
background: #2f98f9;
}
input[type=range].styled-slider:active::-moz-range-track {
background: #f5f5f5;
border-color: #c1c1c1;
}
input[type=range].styled-slider.slider-progress::-moz-range-track {
background: linear-gradient(#007cf8,#007cf8) 0/var(--sx) 100% no-repeat, #efefef;
}
input[type=range].styled-slider.slider-progress:hover::-moz-range-track {
background: linear-gradient(#0061c3,#0061c3) 0/var(--sx) 100% no-repeat, #e5e5e5;
}
input[type=range].styled-slider.slider-progress:active::-moz-range-track {
background: linear-gradient(#2f98f9,#2f98f9) 0/var(--sx) 100% no-repeat, #f5f5f5;
}
/*ms*/
input[type=range].styled-slider::-ms-fill-upper {
background: transparent;
border-color: transparent;
}
input[type=range].styled-slider::-ms-fill-lower {
background: transparent;
border-color: transparent;
}
input[type=range].styled-slider::-ms-thumb {
width: 2em;
height: 2em;
border-radius: 1em;
background: #007cf8;
border: none;
box-shadow: 0 0 2px black;
margin-top: 0;
box-sizing: border-box;
}
input[type=range].styled-slider::-ms-track {
height: 1em;
border-radius: 0.5em;
background: #efefef;
border: 1px solid #b2b2b2;
box-shadow: none;
box-sizing: border-box;
}
input[type=range].styled-slider::-ms-thumb:hover {
background: #0061c3;
}
input[type=range].styled-slider:hover::-ms-track {
background: #e5e5e5;
border-color: #9a9a9a;
}
input[type=range].styled-slider::-ms-thumb:active {
background: #2f98f9;
}
input[type=range].styled-slider:active::-ms-track {
background: #f5f5f5;
border-color: #c1c1c1;
}
input[type=range].styled-slider.slider-progress::-ms-fill-lower {
height: max(calc(1em - 1px - 1px),0px);
border-radius: 0.5em 0 0 0.5em;
margin: -1px 0 -1px -1px;
background: #007cf8;
border: 1px solid #b2b2b2;
border-right-width: 0;
}
input[type=range].styled-slider.slider-progress:hover::-ms-fill-lower {
background: #0061c3;
border-color: #9a9a9a;
}
input[type=range].styled-slider.slider-progress:active::-ms-fill-lower {
background: #2f98f9;
border-color: #c1c1c1;
}
ordinary slider:<br />
<input type="range" class="styled-slider" style="width: 20em;" /><br />
slider with progress styling (made it slightly longer):<br />
<input type="range" class="styled-slider slider-progress" style="width: 30em;" />

Input-type range with custom css - thumb not showing correct in IE

My web page looks good in all other browsers than IE. Here the thumb of my range sliders are "cut off".
My code is here:
https://jsfiddle.net/t1pw9rh2/
HTML:
<form action="url-link-here" method="post">
<span id="mydiv">100</span>
<input class="input-range" id="sizeID" onchange="test()" oninput="test()" type="range" name="size" value="100" min="5" max="250" step ="5">
</form>
CSS:
input[type=range] {
-webkit-appearance: none;
margin: 10px 0;
width: 100%;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 10px;
cursor: pointer;
animate: 0.2s;
box-shadow: 0px 0px 0px #000000;
background: #fff;
border-radius: 1px;
border: 1px solid #39404D;
}
input[type=range]::-webkit-slider-thumb {
box-shadow: 0px 0px 0px #000000;
border: 1px solid #39404D;
height: 28px;
width: 16px;
border-radius: 2px;
background: #fff;
cursor: pointer;
-webkit-appearance: none;
margin-top: -10px;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: #fff;
}
input[type=range]::-moz-range-track {
width: 100%;
height: 10px;
cursor: pointer;
animate: 0.2s;
box-shadow: 0px 0px 0px #000000;
background: #fff;
border-radius: 1px;
border: 1px solid #39404D;
}
input[type=range]::-moz-range-thumb {
box-shadow: 0px 0px 0px #000000;
border: 1px solid #39404D;
height: 28px;
width: 16px;
border-radius: 2px;
background: #fff;
cursor: pointer;
}
input[type=range]::-ms-track {
width: 100%;
height: 10px;
cursor: pointer;
animate: 0.2s;
background: transparent;
border-color: transparent;
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #fff;
border: 1px solid #39404D;
border-radius: 4px;
box-shadow: 0px 0px 0px #000000;
}
input[type=range]::-ms-fill-upper {
background: #fff;
border: 1px solid #39404D;
border-radius: 4px;
box-shadow: 0px 0px 0px #000000;
}
input[type=range]::-ms-thumb {
box-shadow: 0px 0px 0px #000000;
border: 1px solid #39404D;
height: 28px;
width: 16px;
border-radius: 2px;
background: #fff;
cursor: pointer;
}
input[type=range]:focus::-ms-fill-lower {
background: #fff;
}
input[type=range]:focus::-ms-fill-upper {
background: #fff;
}
Javascript:
function test(){
var myDivElem = document.getElementById("mydiv");
var sizerange= document.getElementById("sizeID");
myDivElem.innerHTML = sizerange.value;
}
My web page can be seen here:
http://negoto.azurewebsites.net/
How do I fix the css so the thumb looks good in IE?
Best, Peter
I found the answer here. http://brennaobrien.com/blog/2014/05/style-input-type-range-in-every-browser.html
It mentions you cant style the thumb bigger than the track in IE.

How to change the position of image in search box in css?

I have been created simple search form, using by google.
Here is my jsfiddle link: http://jsfiddle.net/njs6d489/
In that, search icon right side right?
But i need icon looking left side and placeholder also need to place left side.
I explained in this image http://s22.postimg.org/ype712rcx/Untitled_1.png
May i know, how can i do this. Is there possible to do this?
Thanks in advance.
body {
background: #fff;
color: #666;
font: 90%/180% Arial, Helvetica, sans-serif;
width: 800px;
max-width: 96%;
margin: 0 auto;
}
a {
color: #69C;
text-decoration: none;
}
a:hover {
color: #F60;
}
input {
outline: none;
}
input[type=search] {
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
font-family: inherit;
font-size: 100%;
}
input::-webkit-search-decoration,
input::-webkit-search-cancel-button {
display: none;
}
input[type=search] {
background: #ededed url(http://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 9px center;
border: solid 1px #ccc;
padding: 9px 10px 9px 32px;
width: 55px;
-webkit-border-radius: 10em;
-moz-border-radius: 10em;
border-radius: 10em;
-webkit-transition: all .5s;
-moz-transition: all .5s;
transition: all .5s;
}
input[type=search]:focus {
width: 130px;
background-color: #fff;
border-color: #66CC75;
-webkit-box-shadow: 0 0 5px rgba(109,207,246,.5);
-moz-box-shadow: 0 0 5px rgba(109,207,246,.5);
box-shadow: 0 0 5px rgba(109,207,246,.5);
}
input:-moz-placeholder {
color: #999;
}
input::-webkit-input-placeholder {
color: #999;
}
/* Demo 2 */
#demo-2 input[type=search] {
width: 15px;
padding-left: 10px;
color: transparent;
cursor: pointer;
}
#demo-2 input[type=search]:hover {
background-color: #fff;
}
#demo-2 input[type=search]:focus {
width: 130px;
padding-left: 32px;
color: #000;
background-color: #fff;
cursor: auto;
}
#demo-2 input:-moz-placeholder {
color: transparent;
}
#demo-2 input::-webkit-input-placeholder {
color: transparent;
}
Are you expecting like this: Demo
Updated Demo
I changed the search icon's background position at Normal state as 50% and on focus as 90%.
Here I included only the css which I changed.
CSS:
input[type=search] {
background: #ededed url(http://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 50% center;
float:right;
}
input[type=search]:focus {
background: #ededed url(http://static.tumblr.com/ftv85bp/MIXmud4tx/search-icon.png) no-repeat 90% center;
}