How to customize only with css for html5 input range slider-vertical? - css

I would like to customize the look of a html5 input[range] when it's vertical.
Want to avoid CSS 3 directive like transform:rotate, it complicates the UI layout then.
Webkit css properties are recognised in my context, the others vendors are useless in my case.
The customisation works good for the horizontal default slider, but not for the vertical one, you can look at here :
jsFiddle : http://jsfiddle.net/QU5VD/1/
Otherwise, here's the code :
HTML
<input type="range" class="vHorizon" />
<input type="range" class="vVertical" />
CSS
input[type="range"].vHorizon {
-webkit-appearance: none;
background-color: pink;
width: 200px;
height:10px;
}
input[type="range"].vVertical {
-webkit-appearance: slider-vertical;
background-color: pink;
width: 10px;
height:200px;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
background-color: red;
width: 20px;
height: 20px;
}

******UPDATED ANSWER****
If i understand you correctly, you are trying to make you vertical look like what your horizontal looks like? if so:
input[type=range].vVertical {
-webkit-appearance: none;
background-color: green;
width: 200px;
height:10px;
-webkit-transform:rotate(90deg);
-moz-transform:rotate(90deg);
-o-transform:rotate(90deg);
-ms-transform:rotate(90deg);
transform:rotate(90deg);
z-index: 0;
}
input[type=range].vHorizon {
-webkit-appearance: none;
background-color: pink;
height: 10px;
width:200px;
}
input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
background-color: red;
width: 20px;
height: 20px;
}
fiddle <--UPDATED

Related

Multiple <progress> elements on a page with different colors

I'm using the element and I've found good instructions on [styling] (http://html5doctor.com/the-progress-element/).
I'd like to have more than one progress bar on a page and I'd like them to have different fill/value colors. Is this possible? Can I do this by tweaking my CSS? Or an I better off rolling my own? Thanks!
.current-roll {
-webkit-appearance: none;
width: 80%;
height: 25px;
/* next line does nothing */
color: #f7a700
}
.previous-roll {
-webkit-appearance: none;
width: 80%;
height: 25px;
/* next line does nothing */
color: #98c11e
}
progress::-webkit-progress-bar {
background: #d8d8d8;
}
progress::-webkit-progress-value {
background: #f7a700;
}
<p>Orange bar</p>
<progress class="current-roll" value="0.5"></progress>
<p>Green bar</p>
<progress class="previous-roll" value="0.75"></progress>
progress::-webkit-progress-value is what changes the progress bar color.
Example
progress.current-roll::-webkit-progress-value {
background: #f7a700;
}
You already have what you look for in the example you have given!
use progress.current-rollto style the colors specifically for .current-roll for instance
example below:
.current-roll {
-webkit-appearance: none;
width: 80%;
height: 25px;
/* next line does nothing */
color: #f7a700
}
.previous-roll {
-webkit-appearance: none;
width: 80%;
height: 25px;
/* next line does nothing */
color: #98c11e
}
progress.previous-roll::-webkit-progress-bar {
background: #d8d8d8;
}
progress.previous-roll::-webkit-progress-value {
background: #f7a700;
}
progress.current-roll::-webkit-progress-bar {
background: #ddd;
}
progress.current-roll::-webkit-progress-value {
background: red;
}
<p>Red bar</p>
<progress class="current-roll" value="0.5"></progress>
<p>Orange bar</p>
<progress class="previous-roll" value="0.75"></progress>

how to style html5 date input, first element focus/active

I have a date input that I've styled but I can't remove a blue highlight.
Here is a pen:
http://codepen.io/pjrundle/pen/PqjKBZ
<input id="selectedDate" type="date" class="date-filter pseudo-input live-update" placeholder="Event Date">
::-webkit-inner-spin-button {
display: none;
}
::-webkit-clear-button {
display: none;
-webkit-appearance: none;
}
::-webkit-calendar-picker-indicator {
opacity: 0;
height: 14px;
width: 80px;
border: 1px solid green;
z-index: 2;
position: absolute;
left: 9px;
top: 8px;
}
so when you click on the input, the first element should not go blue. Does anyone know how to do this?
The first element goes blue to indicate that it is the active element (in case you want to update the date using the keyboard), you can style it by specifying that it should not have a background using the pseudo-elements:
::-webkit-datetime-edit-month-field
::-webkit-datetime-edit-day-field
::-webkit-datetime-edit-year-field
Notice: you should style not only the month, but all three elements (day/month/year) as you don't know which date format the user's computer will have. The code would be like this:
::-webkit-datetime-edit-month-field { background: none; }
::-webkit-datetime-edit-day-field { background: none; }
::-webkit-datetime-edit-year-field { background: none; }
And your example would look like this:
::-webkit-datetime-edit-month-field { background: none; }
::-webkit-datetime-edit-day-field { background: none; }
::-webkit-datetime-edit-year-field { background: none; }
::-webkit-inner-spin-button {
display: none;
}
::-webkit-clear-button {
display: none;
-webkit-appearance: none;
}
::-webkit-calendar-picker-indicator {
opacity: 0;
height: 14px;
width: 80px;
border: 1px solid green;
z-index: 2;
position: absolute;
left: 9px;
top: 8px;
}
<input id="selectedDate" type="date" class="date-filter pseudo-input live-update" placeholder="Event Date">
Check this question for a list of all the pseudo-elements that you can use.

Apply a class AND an attribute selector

I want to style this element:
<input class="myslider" type="range" value="20">
This is working:
input[class*="myslider"] {
-webkit-appearance: none;
width: 100px;
background-color: black;
height: 2px;
}
But this is not working:
.myslider input[type=range] {
-webkit-appearance: none;
width: 100px;
background-color: black;
height: 2px;
}
Why can't I apply a class selector and an attribute selector?
The selector you're looking for is
input.myslider[type=range]
Your current code looks for children elements and doesn't target the appropriate element.
Becuase you are selecting input inside .mySlider. Try this:
.myslider[type='range'] {
-webkit-appearance: none;
width: 100px;
background-color: black;
height: 2px;
}
DEMO

How to make the mozilla progressbar the same as chrome

I'm using the tag but in mozilla it looks like this:
but i want to make it like this:
the code im using for the lastone:
progress[value] {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
width: 100px;
height: 20px;
}
Any idea how to make then the same?
progress::-moz-progress-bar { background: green; }
progress {
height: 50px;
padding: 0;
border: none;
}

change scroll-bar format in Mozilla and I.E like chrome

I want to change scroll-bar color and other properties;
So I wrote the code bellow for chrome:
/* Chrome */
.contex#context::-webkit-scrollbar { width: 10px; height: 0px;}
.contex#context::-webkit-scrollbar-button { background-color: #800000; }
.contex#context::-webkit-scrollbar-track { background-color: #40210f;}
.contex#context::-webkit-scrollbar-track-piece { background-color: #ffffff;}
.contex#context::-webkit-scrollbar-thumb { height: 50px; background-color: #40210f; border-radius: 50%;}
.contex#context::-webkit-resizer { background-color: #666;}
/* Chrome */
This is jsfiddle and This is full screen if you use chrome you can see right result.
and I tried this code for I.E. :
.contex#context {
background-color:#fff;
overflow:scroll;
width:565px;
height:490px;
padding-right:5px;
margin-left:140px;
margin-top:100px;
text-align:right;
font-family:"B Koodak",Arial, Sens Serif;
position:absolute;
/* I.E scroll-bar */
scrollbar-face-color: #40210f;
scrollbar-track: transparant;
scrollbar-base-color: #40210f;
scrollbar-face-color: #40210f;
scrollbar-3dlight-color: #800000;
scrollbar-highlight-color: #FFF;
scrollbar-track-color: #FFFFFF;
scrollbar-arrow-color: #40210f;
scrollbar-shadow-color: white;
scrollbar-dark-shadow-color: #800000;
}
But it's not enough for my case.
Now I want to change scroll-bar in I.E and Mozila like I did for chrome.
Specially I want to change scrollbar-thumb with border-radius
Do you have suggestion for me to make something like this in FireFox and I.E.?Thanks in advance.
What you can use is this Jquery Plugin.
http://jscrollpane.kelvinluck.com/fullpage_scroll.html
You will need all of these plugins:
jquery
mousewheel
mwheelIntent
scrollpane
Once you acquire all of these and implement them, then you can edit the CSS for the scrollbars to what you want. Make sure you use the code provided on that page.
For instance, on the page I provided, these CSS styles can be altered to get what you want.
.jspArrow {
background: #800000; // Changed color
text-indent: -20000px;
display: block;
cursor: pointer;
padding: 0;
margin: 0;
}
.jspArrow.jspDisabled {
cursor: default;
background: #800000; // Color change, but line not necessary
}
.jspDrag {
background: #40210f; // Changed color
position: relative;
top: 0;
left: 0;
cursor: pointer;
border-radius: 50%; // Added line
}
.jspTrack {
background: #dde; // Remove this line
position: relative;
}
.jspVerticalBar {
position: absolute;
top: 0;
right: 0;
width: 16px;
height: 100%;
background: red; // Remove this line
}
Realize that border-radius does not work on older versions of Internet Explorer.
Check out your options here: http://www.unheap.com/?s=scroll
The most popular solution seems to be http://www.yuiazu.net/perfect-scrollbar/

Resources