简体   繁体   中英

White “background” on input range when using border radius

You can find a screenshot of my problem here ; While trying to style the range input I noticed that it has white corners. I can't seem to figure out why or how to remove them, I first thought it was an outline but setting outline to none did nothing. Here is a JSFiddle: http://jsfiddle.net/c1y0y7dj/

My CSS

input[type=range] {
    -webkit-appearance: none;

    width: 200px;
}
input[type=range]::-webkit-slider-runnable-track {
    width: 200px;
    height: 5px;
    background: #565656;
    border: none;
    border-radius: 3px;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    border: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #F06A00;
    margin-top: -5px;
}
input[type=range]:focus {
    outline: none;
}
input[type=range]::-moz-range-track {
    width: 200px;
    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: #F06A00;
}

input[type=range]::-ms-track {
    width: 200px;
    height: 5px;

    background: transparent;

    border-color: transparent;
    border-width: 6px 0;

    color: transparent;
}
input[type=range]::-ms-fill-lower {
    background: #373737;
    border-radius: 10px;
}
input[type=range]::-ms-fill-upper {
    background: #575757;
    border-radius: 10px;
}
input[type=range]::-ms-thumb {
    border: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: #F06A00;
}
input[type=range]:focus::-ms-fill-lower {
    background: #373737;
}
input[type=range]:focus::-ms-fill-upper {
    background: #575757;
}

Try this css

input[type=range] {
    -webkit-appearance: none;
    width: 200px;
    background-color: transparent;
}

Here is the solution

You should add to

input[type=range] {
    -webkit-appearance: none;
    width: 200px;
    background: transparent;
}

The input tag by default has a white background set by chrome if you just added

background-color :#565656 ;

to your first input selector it should solve your issue

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM