Below is the css for my slider. The problem is that the slider is totally failing on IE.
Here is also the online version: https://codepen.io/mariomez/pen/yLNYdRg
I tried using MS fillers but it didn't go well as I am not familiar with how to properly use them.
.valeurPrix {
position: absolute;
top: -59px;
left: 177px;
}
.range-slider {
position: relative;
width: 450px;
float: left;
margin-right: 5px;
}
.range-slider .input-range {
-webkit-appearance: none;
width: 449px;
height: 5px;
border-radius: 5px;
background: #ccc;
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;
}
Can you please guide me on how to use MS fillers on this code?
First, since the input event only supports input of type text and password in the IE browser, I suggest you could try to use the mouseup event to get the range value. Code as below:
var range = $('.input-range'),
value = $('.range-value');
value.html(range.attr('value') + ' %');
range.on('mouseup', function() {
value.html(this.value + ' %');
});
Second, please try to use the following CSS style:
<style>
* {
-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;
}
body {
font-family: sans-serif;
padding: 40px;
}
.valeurPrix {
position: absolute;
top: -59px;
left: 177px;
}
.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;
}
input[type=range]::-ms-thumb {
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: #164188;
}
input[type=range]:focus::-ms-fill-lower {
background: #ccc;
}
input[type=range]:focus::-ms-fill-upper {
background: #ccc;
}
</style>
The result in IE browser as below (you could find the whole sample code from here):
body {
padding: 30px;
}
input[type=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: 300px;
}
input[type=range]::-webkit-slider-runnable-track {
width: 300px;
height: 5px;
background: #ddd;
border: none;
border-radius: 3px;
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: goldenrod;
margin-top: -4px;
}
input[type=range]:focus {
outline: none;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: #ccc;
}
input[type=range]::-moz-range-track {
width: 300px;
height: 5px;
background: #ddd;
border: none;
border-radius: 3px;
}
input[type=range]::-moz-range-thumb {
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: goldenrod;
}
/*hide the outline behind the border*/
input[type=range]:-moz-focusring{
outline: 1px solid white;
outline-offset: -1px;
}
input[type=range]::-ms-track {
width: 300px;
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: #777;
border-radius: 10px;
}
input[type=range]::-ms-fill-upper {
background: #ddd;
border-radius: 10px;
}
input[type=range]::-ms-thumb {
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: goldenrod;
}
input[type=range]:focus::-ms-fill-lower {
background: #888;
}
input[type=range]:focus::-ms-fill-upper {
background: #ccc;
}
<input type="range">
Related
I have a button with a hover effect that fills the background from left to right:
Current HTML
Mehr erfahren
Current CSS
body {
background-color: #f6f6f6;
}
a {
text-decoration: none;
color: black;
}
a:hover {
text-decoration: none;
}
.button {
font-size: 20px;
color: black;
background-color: white;
padding: 20px;
border-radius: 50px;
display: inline-block;
background-image: radial-gradient(circle at left, black 50%, black 50%);
background-size: 0 100%;
background-repeat: no-repeat;
transition: 0.4s;
}
.button:hover {
color: white;
background-size: 100% 100% !important;
}
.button::before {
content: "";
display: inline-block;
width: 15px;
height: 15px;
-moz-border-radius: 7.5px;
-webkit-border-radius: 7.5px;
border-radius: 7.5px;
background-color: white;
border: 1px solid black;
margin-right: 15px;
}
Find it also here on codepen
Goal is that the right side of the fill color has rounded corners like here:
Any ideas? Thanks in advance
As mentioned in this other SO question, there is no way to add border-radius directly to the background-image. If you are open to another option to get your desired result using a pseudo background element and adding a <span> around your text for z-index adjustment, then you can reference my example below.
body {
background-color: #f6f6f6;
}
a {
text-decoration: none;
color: black;
}
a:hover,
a:focus {
text-decoration: none;
}
.button {
font-size: 20px;
color: black;
background-color: white;
padding: 20px;
border-radius: 50px;
display: inline-block;
transition: 0.4s;
}
.button:hover,
.button:focus {
color: white;
}
/* New CSS */
.button {
position: relative;
overflow: hidden;
-webkit-mask-image: -webkit-radial-gradient(white, black);
}
.button:hover::after,
.button:focus::after {
transform: translateX(0);
}
.button::after {
content: '';
position: absolute;
top: 0;
left: 0;
background: #000;
width: 100%;
height: 100%;
border-radius: 50px;
transform: translateX(-100%);
z-index: 0;
transition: 0.4s;
}
.button span {
position: relative;
z-index: 1;
}
.button span::before {
content: "";
display: inline-block;
width: 15px;
height: 15px;
-moz-border-radius: 7.5px;
-webkit-border-radius: 7.5px;
border-radius: 7.5px;
background-color: white;
border: 1px solid black;
margin-right: 15px;
}
<span>Mehr erfahren</span>
I have a customized button/link element that transforms the said element to look like this:
Problem I'm having is that when the button is focused using keyboard the outline is not transformed along the borders of the element. I've also tried using box-shadow, with same results. Is there a proper way to transform outline, like I did with the element itself?
.button {
font-family: $brand-font;
font-weight: 900;
transition: color $transition-duration ease-out;
-webkit-appearance: none;
-moz-appearance: none;
display: inline-block;
text-align: center;
max-width: 320px;
min-width: 200px;
height: 40px;
line-height: 40px;
position: relative;
border: none !important;
font-size: 1.4rem;
z-index: 0;
padding: 0 1.8rem;
background-color: transparent;
color: $primary-blue;
cursor: pointer;
&:visited {
border: none !important;
}
&.skewOnHover {
color: $secondary-blue;
}
& > svg {
vertical-align: middle;
}
&:focus {
outline: 2px solid $primary-blue;
// box-shadow: 0 0 0 2px $primary-blue;
}
&::before {
content: ""; display: block;
display: block;
width: 100%; height: 100%;
top: -2px; left: -2px;
transition-property: border, background-color, transform;
transition-duration: $transition-duration;
transition-timing-function: ease-out;
position: absolute;
z-index: -1;
// regular (cyan background, blue text)
background-color: $secondary-blue;
border: 2px solid $secondary-blue;
transform: skew(-22.5deg);
}
&.skewOnHover {
&::before {
background-color: transparent;
transform: skew(22.5deg);
}
}
Apply the outline to skewed element:
&:focus:before {
outline: 2px solid red;
}
and reset the outline of button:
.button:focus {
outline: none;
}
.button {
font-weight: 900;
transition: color 0.3s ease-out;
-webkit-appearance: none;
-moz-appearance: none;
display: inline-block;
text-align: center;
max-width: 320px;
min-width: 200px;
height: 40px;
line-height: 40px;
position: relative;
border: none !important;
font-size: 1.4rem;
z-index: 0;
padding: 0 1.8rem;
background-color: transparent;
color: blue;
cursor: pointer;
}
.button:visited {
border: none !important;
}
.button.skewOnHover {
color: dodgerblue;
}
.button>svg {
vertical-align: middle;
}
.button:focus {
outline: none;
}
.button:focus:before {
outline: 2px solid red;
}
.button::before {
content: "";
display: block;
display: block;
width: 100%;
height: 100%;
top: -2px;
left: -2px;
transition-property: border, background-color, transform;
transition-duration: 0.3s;
transition-timing-function: ease-out;
position: absolute;
z-index: -1;
background-color: dodgerblue;
border: 2px solid dodgerblue;
transform: skew(-22.5deg);
}
.button.skewOnHover::before {
background-color: transparent;
transform: skew(22.5deg);
}
<button class="button">button</button>
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;
}
I'm having an issue customizing the CSS of some button widgets that came with a WordPress theme I'm running. I grabbed a quick screen capture video of what's happening because it's hard to describe.
Video Link: https://drive.google.com/open?id=1mYvOtAjz-0QnJYV3_nGYXnFoRpsRdVo_
The CSS I have applied on the buttons:
.lc_button {
height: 100px !important;
width: 200px !important;
font-size: 18px !important;
border: 1px solid #dd3333 !important;
text-align: center;
background-color: white;
border-radius: 5%;
}
.lc_button:hover {
background-color: white;
border: 4px solid #dd3333 !important;
color: #151515 !important;
}
.lc_button a:hover {
color: #151515 !important;
}
Any idea what I have to do to get the inside to stay visible no matter where the cusror is at inside the button?
Thanks
I've tried to solve your problem. I am successful. You can use this code of mine.
HTML
<div class="lc_button">
Watch video
</div>
CSS
.lc_button a {
display: block;
width: 200px;
height: 100px;
line-height: 100px;
font-size: 18px;
font-weight: 700;
color: #000000;
border-radius: 5%;
box-sizing: border-box;
transition: 0.3s;
background-color: white;
text-decoration: none;
text-transform: uppercase;
text-align: center;
position: relative;
}
.lc_button a:before {
display: block;
position: absolute;
border-radius: 5%;
left: 0;
top: 0;
content: "";
width: 200px;
height: 100px;
box-sizing: border-box;
border: 1px solid red;
transition: 0.3s;
}
.lc_button a:hover:before {
border: 4px solid red;
}
.lc_button a:hover {
color: #151515 !important;
background-color: #ffffff;
}
.lc_button a {
display: block;
width: 200px;
height: 100px;
line-height: 100px;
font-size: 18px;
font-weight: 700;
color: #000000;
border-radius: 5%;
box-sizing: border-box;
transition: 0.3s;
background-color: white;
text-decoration: none;
text-transform: uppercase;
text-align: center;
position: relative;
}
.lc_button a:before {
display: block;
position: absolute;
border-radius: 5%;
left: 0;
top: 0;
content: "";
width: 200px;
height: 100px;
box-sizing: border-box;
border: 1px solid red;
transition: 0.3s;
}
.lc_button a:hover:before {
border: 4px solid red;
}
.lc_button a:hover {
color: #151515 !important;
background-color: #ffffff;
}
<div class="lc_button">
Watch video
</div>
The .css you've provided seems fully functional, and customizable. (aka, not broken, works fine).
The whole .css and the .html might shed some light on things without any "major alterations".
.lc_button {
height: 100px !important;
width: 200px !important;
font-size: 18px !important;
border: 1px solid #dd3333 !important;
text-align: center;
background-color: white;
border-radius: 5%;
}
.lc_button:hover {
background-color: white;
border: 4px solid #0000ff !important;
color: #00ff00 !important;
}
.lc_button a:hover {
color: #151515 !important;
}
<body>
<button class="lc_button">Test</button>
</body>
I've shared the code snippet..I think this will help you to solve the problem...
*, *:after, *:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body{
font-family: 'PT Sans', sans-serif;
display: table;
width: 100%;
background: #f54785;
}
.container{
display: table-cell;
vertical-align: middle;
text-align: center;
height: 100vh;
}
button{
display: inline-block;
position: relative;
background: none;
border: none;
color: #fff;
font-size: 18px;
cursor: pointer;
margin: 20px 30px;
background: rgba(0,0,0,0.09);
}
span{
display: block;
padding: 25px 80px;
}
button::before, button::after{
content:"";
width: 0;
height: 2px;
position: absolute;
transition: all 0.2s linear;
background: #fff;
}
span::before, span::after{
content:"";
width:2px;
height:0;
position: absolute;
transition: all 0.2s linear;
background: #fff;
}
button:hover::before, button:hover::after{
width: 100%;
}
button:hover span::before, button:hover span::after{
height: 100%;
}
.btn-1::after{
left:0;
bottom: 0;
transition-duration: 0.4s;
}
.btn-1 span::after{
right:0;
top: 0;
transition-duration: 0.4s;
}
.btn-1::before{
right: 0;
top: 0;
transition-duration: 0.4s;
}
.btn-1 span::before{
left: 0;
bottom: 0;
transition-duration: 0.4s;
}
<div class="container">
<button class="btn-1"><span>Hover Me</span></button>
</div>
This will help you to solve the problem...
button {
height: 100px !important;
width: 200px !important;
font-size: 18px !important;
border: 1px solid #dd3333 !important;
text-align: center;
background-color: white;
border-radius: 5%;
}
button:hover {
background-color: white;
border: 4px solid #dd3333 !important;
color: #151515 !important;
}
button a:hover {
color: #151515 !important;
}
<div class="container">
<button class="lc_button"><span>Hover Me</span></button>
</div>
I'm able to achieve this effect, "the white range track going beyond yellow circle" on an HTML range slider using CSS, but when viewing the slider on google chrome the sliders track don't show the same effect as show in the images.
here is my code for the range slider :
.slider {
-webkit-appearance: none;
width: 615px;
margin: 25px 0;
height: 15px;
border-radius: 5px;
background: transparent;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
text-align: center;
}
.slider input {
text-align: center;
}
.slider:hover {
opacity: 1;
}
.slider::-webkit-slider-runnable-track {
height: 5px;
width: 102%;
cursor: pointer;
background: #ffffff;
}
.slider::-moz-range-track {
height: 5px;
width: 102%;
cursor: pointer;
background: #ffffff;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 18px;
height: 18px;
margin: -7px 0 0;
border: 0;
border-radius: 50%;
background: #F2E375;
cursor: pointer;
border: 0 !important;
}
.slider::-moz-range-thumb {
width: 18px;
height: 18px;
border: 0;
border-radius: 50%;
background: #F2E375;
cursor: pointer;
border: 0 !important;
}
.background {
background:#64c2c8;
}
<html>
<body class="background">
<input type="range" min="1" max="5" value="1" class="slider" id="mySlider" steps="1">
</body>
</html>
Padding worked for me:
padding-left: 10px;
padding-right: 10px;
.slider {
-webkit-appearance: none;
width: 615px;
margin: 25px 0;
height: 15px;
border-radius: 5px;
background: transparent;
outline: none;
opacity: 0.7;
-webkit-transition: .2s;
transition: opacity .2s;
text-align: center;
}
.slider input {
text-align: center;
}
.slider:hover {
opacity: 1;
}
.slider::-webkit-slider-runnable-track {
height: 5px;
width: 102%;
padding-left: 10px;
padding-right: 10px;
cursor: pointer;
background: #ffffff;
}
.slider::-moz-range-track {
height: 5px;
width: 102%;
cursor: pointer;
background: #ffffff;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 18px;
height: 18px;
margin: -7px 0 0;
border: 0;
border-radius: 50%;
background: #F2E375;
cursor: pointer;
border: 0 !important;
}
.slider::-moz-range-thumb {
width: 18px;
height: 18px;
border: 0;
border-radius: 50%;
background: #F2E375;
cursor: pointer;
border: 0 !important;
}
.background {
background:#64c2c8;
}
<html>
<body class="background">
<input type="range" min="1" max="5" value="1" class="slider" id="mySlider" steps="1">
</body>
</html>