IOS / Android / Windows HTML range slider inconsistency - html

I have the following vertical range slider setup.
Codepen LINK
Example here:
body{
display: flex;
justify-content:space-evenly;
align-items:center;
align-content:start;
flex-wrap:wrap;
width: 100%;
height: 100vh;
overflow:hidden;
}
:root{
--shader_top_half_color: cornflowerblue;
--shader_thumb_color: #5e7cd3;
--group_shader_top_half_color: #4bcca1;
--group_shader_thumb_color: #4cbb9f;
}
.shaderRangeWrapper {
width: 100px;
display: flex;
flex-direction: column;
gap: 45px;
justify-content: center;
align-items: center;
margin-top: 35px;
-webkit-tap-highlight-color: transparent;
position: relative;
}
input.shaderRange {
-webkit-tap-highlight-color: transparent;
transform: rotate(90deg);
height: 100px;
width: 150px !important;
margin: 0px;
padding: 0px;
-webkit-appearance: none;
background: transparent;
touch-action: none;
overflow: hidden;
border-radius: 0.5rem;
box-shadow: rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px;
}
/* REMOVE BASIC STYLES */
.shaderRange::-webkit-slider-thumb {
-webkit-appearance: none;
}
.shaderRange:focus {
outline: none;
}
.shaderRange::-ms-track {
width: 100%;
cursor: pointer;
background: transparent;
border-color: transparent;
color: transparent;
}
/* STYLE THE THUMB FOR SPECIFIC BROWSERS */
/* Special styling for WebKit/Blink */
.shaderRange::-webkit-slider-thumb {
-webkit-appearance: none;
height: 90px;
width: 10px;
border-radius: 0.5rem;
background: var(--shader_thumb_color);
cursor: pointer;
margin-top: 5px;
box-shadow: -80px 0 0 75px var(--shader_top_half_color);
/* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
}
/* All the same stuff for Firefox */
.shaderRange::-moz-range-thumb {
height: 90px;
width: 10px;
border-radius: 0.5rem;
background: var(--shader_thumb_color);
cursor: pointer;
margin-top: 5px;
box-shadow: -80px 0 0 75px var(--shader_top_half_color);
}
/* All the same stuff for IE */
.shaderRange::-ms-thumb {
height: 90px;
width: 10px;
border-radius: 0.5rem;
background: var(--shader_thumb_color);
cursor: pointer;
margin-top: 5px;
box-shadow: -80px 0 0 75px var(--shader_top_half_color);
}
/* STYLE THE TRACK FOR SPECIFIC BROWSERS */
.shaderRange::-webkit-slider-runnable-track {
height: 100px;
height: 100px;
cursor: pointer;
background: transparent;
border-radius: 0.3rem;
}
.shaderRange:focus::-webkit-slider-runnable-track {
background: transparent;
}
.shaderRange::-moz-range-track {
height: 100px;
height: 100px;
cursor: pointer;
background: transparent;
border-radius: 0.3rem;
}
.shaderRange::-ms-track {
height: 100px;
height: 100px;
cursor: pointer;
background: transparent;
border-radius: 0.3rem;
}
/* GROUP SHADER STYLE */
/* Special styling for WebKit/Blink */
.shaderRange.groupShaderRange::-webkit-slider-thumb {
-webkit-appearance: none;
height: 90px;
width: 10px;
border-radius: 0.5rem;
background: var(--group_shader_thumb_color);
cursor: pointer;
margin-top: 5px;
box-shadow: -80px 0 0 75px var(--group_shader_top_half_color);
/* You need to specify a margin in Chrome, but in Firefox and IE it is automatic */
}
/* All the same stuff for Firefox */
.shaderRange.groupShaderRange::-moz-range-thumb {
height: 90px;
width: 10px;
border-radius: 0.5rem;
background: var(--group_shader_thumb_color);
cursor: pointer;
margin-top: 5px;
box-shadow: -80px 0 0 75px var(--group_shader_top_half_color);
}
/* All the same stuff for IE */
.shaderRange.groupShaderRange::-ms-thumb {
height: 90px;
width: 10px;
border-radius: 0.5rem;
background: var(--group_shader_thumb_color);
cursor: pointer;
margin-top: 5px;
box-shadow: -80px 0 0 75px var(--group_shader_top_half_color);
}
<div class="shaderRangeWrapper">
<input type="range" min="0" max="100" class="shaderRange">
<span class="shaderRangeName">Test 1</span>
</div>
On Android and Windows, i can click/tap anywhere on the slider and the thumb will follow my finger/cursor from where i clicked/tapped and it will not trigger a change until i release it. On IOS ( tested on Iphone 7 plus, 8 and X ) i can only slide the range if i manage to hit the thumb. If i miss tap and did not hit the slider's thumb, the slider will trigger a change and the thumb will not follow my tapping. How can i make this consistent on platforms?
HERE IS A DRIVE LINK To A VIDEO DEMONSTRATING THE GOOD BEHAVIOUR ON ANDROID AND THE BAD ON IOS
EDIT: The bad behaviour description was wrong. On IOS if i miss the thumb, it will not trigger a change, but the thumb will not follow my finger and i don't know where it is. Often times it does not change the range at all if i release it.

Related

Input [range] Slider Breaks on Mobile when Parent Div has transform:rotate(90deg)

Per the code snippet below, I am trying to create a tool tray with vertical sliders, styled like procreates ui.
When I rotate the tray 90 degrees using transforms to get everything vertical, the sliders break on mobile (any touch device), I can click them to position but pressing and sliding breaks. If I remove the rotate class, all works fine.
Tested on a wacom touch screen monitor, ipad pro and samsung z fold 3, all touch devices the slider is broken on though works as expected with mouse. Pen devices seem to also break, unable to move the sliders smoothly.
Any help fixing this or a better approach would be greatly welcome, trying to get this to work without javascript
/* Desperate to remove focus outline in firefox */
::-moz-focus-inner {
outline:0;
}
:focus {
outline:0;
}
.topcoat-range-input--vertical {
position: relative;
/*padding: 0;
margin: 0;*/
border: none;
box-sizing: border-box;
background-clip: padding-box;
vertical-align: top;
outline: none;
-webkit-appearance: none;
border-radius: 4px;
border: 1px solid #a5a8a8;
background: #CCd3d7d7;
height: 2rem;
border-radius: 4px;
}
.topcoat-range-input--vertical::-webkit-slider-thumb{
cursor: pointer;
-webkit-appearance: none;
}
.topcoat-range-input--vertical::-moz-range-thumb {
cursor: pointer;
}
/*.topcoat-range-input--vertical {
border-radius: 4px;
border: 1px solid #a5a8a8;
background: #d3d7d7;
height: 2rem;
border-radius: 4px;
}*/
.topcoat-range-input--vertical::-webkit-slider-thumb {
height: 2rem;
width: 1.2rem;
border: 1px solid rgba(0,0,0,0.36);
border-radius: 6px;
background: #e5e9e8;
background-size: 7px 18px;
box-shadow: inset 0 1px white;
}
.topcoat-range-input--vertical::-moz-range-thumb {
height: 2rem;
width: 1.2rem;
border: 1px solid rgba(0,0,0,0.36);
border-radius: 6px;
background: #e5e9e8;
background-size: 7px 18px;
box-shadow: inset 0 1px white;
}
::-ms-tooltip,
::-ms-fill-lower {
display: none;
}
.topcoat-range-input--vertical {
/*display: block;
box-sizing: border-box;*/
vertical-align: middle;
}
#tool-setting-palette{
background: #000000;
opacity: 0.8;
height: fit-content;
width: fit-content;
padding: .3em;
border-radius: 0.5em;
position: fixed;
left: 2em;
bottom: 0;
}
.btn {
background-color: transparent;
width: 1.5em;
height: 1.5em;
border: none;
color: white;
font-size: 1.2em;
cursor: pointer;
vertical-align: middle;
}
/* Darker background on mouse-over */
.btn:hover {
color: RoyalBlue;
}
.btn:active {
color: Blue;
transform-origin: center;
transform:scale(0.9);
}
.rotate-rev-90{
transform-origin: center left;
-webkit-transform:rotate(-90deg);
-moz-transform:rotate(-90deg);
-ms-transform:rotate(-90deg);
transform:rotate(-90deg);
}
.rotate-90, .rotate-90 .btn:hover, .rotate-90 .btn:active{
transform-origin: center;
-webkit-transform:rotate(90deg);
-moz-transform:rotate(90deg);
-ms-transform:rotate(90deg);
transform:rotate(90deg);
}
<div id="tool-setting-palette" class="rotate-rev-90">
<button id="redo-btn" type="button" value="" class="btn rotate-90"><i class="fa fa-repeat"></i></button>
<button id="undo-btn" type="button" value="" class="btn rotate-90"><i class="fa fa-undo"></i></button>
<input type='range' class='topcoat-range-input--vertical'>
<input type='range' class='topcoat-range-input--vertical'>
</div>
https://codepen.io/taibhse-designs/pen/zYLxvOj

Different result for different browser with CSS

I have different results for different browsers in the following code:
.flexsearch--wrapper {
height: auto;
width: 50%;
max-width: 700px;
min-width: 100px;
top: 20px;
overflow: hidden;
background: transparent;
margin: 1px;
position: absolute;
}
.flexsearch--form {
overflow: hidden;
position: relative;
}
.flexsearch--form {
padding: 0 66px 0 0;
/* Right padding for submit button width */
overflow: hidden;
}
.flexsearch--input {
width: 100%;
}
.flexsearch {
padding: 0 25px 0 200px;
/* Padding for other horizontal elements */
}
.flexsearch--input {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 30px;
padding: 0 46px 0 10px;
border-color: #888;
border-radius: 3px;
/* (height/2) + border-width */
border-style: solid;
border-width: 2px;
/*margin-top: 10px;*/
color: #333;
font-family: 'Helvetica', sans-serif;
font-size: 16px;
-webkit-appearance: none;
-moz-appearance: none;
}
.flexsearch--submit {
position: absolute;
right: 0;
top: 0;
display: block;
width: 32px;
height: 32px;
padding: 0;
border: none;
margin-top: 4px;
/* margin-top + border-width */
margin-right: 5px;
/* border-width */
background: transparent;
color: #888;
font-family: 'Helvetica', sans-serif;
font-size: 30px;
line-height: 30px;
-webkit-appearance: none;
-moz-appearance: none;
}
.flexsearch--input:focus {
outline: none;
border-color: #333;
}
.flexsearch--input:focus.flexsearch--submit {
color: #333;
}
.flexsearch--submit:hover {
color: #333;
cursor: pointer;
}
/* UPLOAD ICON IMAGE */
#uploadIcon {
/*width: 10%;
height: 100%;*/
padding-top: 10px;
min-width: 80px;
max-width: 80px;
position: absolute;
margin: 0 1% 0 77%;
/* left : 77%;*/
top: -3px;
}
/* SIGN UP / SIGN IN*/
.Signin {
position: fixed;
/*left: 85%;*/
margin-left: 86%;
top: 24px;
/*border : 1.5px solid grey;*/
padding: 3px;
margin-right: 2px;
float: right;
}
/*#Signup {
position: absolute;
left: 93%;
top: 20px;
border : 1.5px solid grey;
padding: 3px;
margin-right: 3px;
}
*/
<div class="flexsearch">
<div class="flexsearch--wrapper">
<form class="flexsearch--form" action="#" method="post">
<div class="flexsearch--input-wrapper">
<input class="flexsearch--input" type="search" placeholder="search">
</div>
<input class="flexsearch--submit" type="submit" value="➜" />
</form>
</div>
</div>
<img src="upload_icon.png" id = "uploadIcon">
Sign In/Sign Up
<!-- Sign Up -->
The problem is that arrow and the Sign In and Sign Up with Firefox works perfectly :
But with Chrome or Safari it doesn't:
Is the problem from my code? or do I need to add some customized code for each browser. And if yes, how can that be done? Can it be done with -webkit or -moz Because I tried this, but it didn't work. Probably, I haven't written it well.

css adjusting vertical positioning of fixed element

I'm having troubles with positioning the textbox for my chat. I can only make it look good for one specific resolution. On other screen sizes it just looks terrible. How can I adjust the position of the textbox for all resolutions (>1360px) to fit in the little darkgrey area on the bottom. When I try to adjust it for one resolution it won't look good on the other resolutions.
https://jsfiddle.net/4pvfwz11/1/
<div class="chatdiv hidden-xs hidden-sm col-lg-2 col-md-3 pull-right" data-spy="affix">
<div class="scrollbar" id="style-2">
<div class="force-overflow"></div>
<ol class="chat">
<div id="fullchat">
<li class="bot"><div class="avatar"><img src="'+msg.avatar+'" draggable="false"/></div><div class="msg"><div class="name">Username</div><p>The chat text should come here..........</p><time><i class="fa fa-clock-o" aria-hidden="true"></i>19:00</time></div></li>
</div>
<div class="chat_error"></div>
</ol>
</div>
<div class="toggle-sound"></div>
<input class="textarea" id="chat_textbox" type="text" placeholder="Enter message here"/>
<style type="text/css">
div.chat_error {
color: #e20f0f;
padding-left: 10px;
padding-top: 1rem;
}
.chatdiv
{
position: fixed;
left: 40px;
background-color: #101010;
height: 90vh;
}
.chatdiv .name{
top: 3px;
left: 110px;
font-size: 10px;
font-weight: bold;
color: rgba(256,256,256,0.80);
cursor: default;
}
/* M E S S A G E S */
.chat {
list-style: none;
background: none;
margin: 0;
padding: 0 0 50px 0;
margin-top: 60px;
margin-bottom: 10px;
}
.chat li {
padding: 0.5rem;
overflow: hidden;
display: flex;
}
.chat .avatar img {
margin-top: 15px;
width: 40px;
height: 40px;
border-radius: 100%;
-webkit-border-radius: 100%;
-moz-border-radius: 100%;
-ms-border-radius: 100%;
background-color: rgba(255,255,255,0.9);
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
.other .msg {
order: 1;
border-top-left-radius: 0px;
box-shadow: -1px 2px 0px #187006;
margin-left: 10px;
background-color: #27af0c;
}
.self {
justify-content: flex-end;
align-items: flex-end;
}
.self .msg {
order: 1;
border-bottom-right-radius: 0px;
background-color: #0a95db;
box-shadow: 1px 2px 0px #055f8c;
margin-left: 10px;
}
.bot .msg {
order: 1;
border-bottom-right-radius: 0px;
background-color: #a50808;
box-shadow: 1px 2px 0px #6b0606;
margin-left: 10px;
}
.msg {
background: white;
min-width: 50px;
padding: 10px;
border-radius: 2px;
box-shadow: 0px 2px 0px rgba(0, 0, 0, 0.07);
}
.msg p {
font-size: 15px;
margin: 0 0 0.2rem 0;
color: white;
}
.msg time {
font-size: 10px;
color: #ccc;
margin-top: 3px;
float: right;
cursor: default;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
/* T Y P E */
input.textarea {
position: absolute;
width: 89%;
height: 50px;
left: 15px;
bottom: 3vh;
background: white;
border: none;
outline: none;
padding-left: 10px;
padding-right: 10px;
color: #666;
font-weight: 400;
}
div.toggle-sound {
position: fixed;
bottom: 13vh;
left: 65px;
font-weight: bold;
font-size: 20px;
}
.scrollbar
{
float: left;
height: 80vh;
background-color: #232323;
overflow-y: scroll;
margin-bottom: 25px;
width: 100%;
}
.force-overflow
{
min-height: 90vh;
}
#style-2::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
background-color: #232323;
}
#style-2::-webkit-scrollbar
{
width: 12px;
background-color: #232323;
}
#style-2::-webkit-scrollbar-thumb
{
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #E20F0F;
}
</style>
If you want different CSS for different screen sizes you can use something called media queries. I don't know exactly what rules you want to change for different screen sizes, but let's do a quick example. Let's say you want to make the background color of the textbox red on screens with a width less than or equal to 900px. This can be done with the following media query:
#media (max-width: 900px) {
input.textarea {
background-color: red;
}
}
So what you can do is just to figure out what CSS changes you want to do on different screen sizes, and then make media queries for all of them. You can read more about media queries here.

CSS outline width not working

I am trying to set outline width of the input element on focus.
Outline width stays the same (like it is default setting which can not be changed), no matter of my setting.
Here is example from code pen
And here is part from css where I am trying to set outline-width on focus:
input:focus {
outline-width: 0.1px;
outline-color: #725b44;
}
EDIT:
I've just forgotten to include line style (solid, dotted...).
Now it works. One thing is still strange to me. Why is outline inside element?
Isnt' the outline defined as 'a line that is drawn around elements (outside the borders) to make the element "stand out".'
Here from my example outline looks like this. I thought it's going to be around element, but it's inside:
Add outline-style: solid to your css.
Since the default style for the outline-style property is none, you will have to set it as well (none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset|initial|inherit). Best value you can use for the style is solid, but that's a matter of preference.
Example for the behavior:
input {
font-size: 22px;
padding: 5px 3px;
color: #666;
}
input.with-outline-style:focus {
outline-width: 3px;
outline-style: solid;
outline-color: #725b44;
/* You could also use the shorthand: */
/* outline: 3px solid #666; */
/* width style color */
}
input.without-outline-style:focus {
outline-width: 3px;
outline-color: #725b44;
}
body {
background-color: #fd9;
}
div {
padding: 5px 10px;
}
<div>
<input type="text" class="with-outline-style" value="outline-style set to solid" />
</div>
<div>
<input type="text" class="without-outline-style" value="outline-style not set" />
</div>
Update
The outline-width setting doesn't work without specifying outline-style: if no outline style is set, the browser will render the outline in its default style (which could be anything, such as a dotted rectangle in IE, a shaded rectangle in Chrome, or even nothing).
Use outline-style
input:focus {
outline-width: 0.1px;
outline-color: #725b44;
outline-style: dotted;
}
Only if you specify outline-style the outline-width will take effect. Please check and let me know your feedback. Thanks!
snippet below:
.divMain {
height: 100vh;
width: 100vw;
border: 0px solid black;
}
.divLogin {
position: absolute;
left: 20%;
top: 5%;
width: 300px;
height: 600px;
border: 1px solid #CF6B08;
border-radius: 3px;
}
#divLogin {
background: #FFCC99;
/* For browsers that do not support gradients */
background: -webkit-linear-gradient(#FAC28A, #FFCC99);
/* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(#FAC28A, #FFCC99);
/* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(#FAC28A, #FFCC99);
/* For Firefox 3.6 to 15 */
background: linear-gradient(#FAC28A, #FFCC99);
/* Standard syntax */
}
.spanTitle {
position: absolute;
top: 10px;
left: 10px;
font-size: 20px;
color: #003399;
font-weight: bold;
}
.inputFirst {
position: absolute;
top: 50px;
margin-left: 5px;
width: calc(100% - 10px);
height: 30px;
}
.divWarningInputFirst {
position: absolute;
width: calc(100% - 10px);
height: 30px;
top: 88px;
margin-left: 5px;
border: 0px solid black;
background-color: #fcdcbb;
color: #ff0000;
font-weight: bold;
padding-top: 5px;
padding-left: 5px;
}
.divWarningInputFirst:after {
content: "";
position: absolute;
top: -5px;
left: 8px;
border-style: solid;
border-width: 0 5px 6px;
border-color: #fcdcbb transparent;
display: block;
width: 0;
z-index: 1;
}
input:focus {
outline-width: 3px;
outline-style: solid;
outline-color: #725b44;
}
input {
border-color: transparent;
padding-left: 3px;
box-sizing: border-box;
}
<div id="divMain" class="divMain">
<div id="divLogin" class="divLogin">
<span id="spanTitle" class="spanTitle">Login</span>
<input type="text" id="inputFirst" class="inputFirst" placeholder="input first">
<div id="divWarningInputFirst" class="divWarningInputFirst">Please enter input first</div>
</div>
</div>
Try
outline: 3px solid #725b44;
or
outline-width:3px;
outline-color:#725b44;
outline-style:solid;
.divMain {
height: 100vh;
width: 100vw;
border: 0px solid black;
}
.divLogin {
position: absolute;
left: 20%;
top: 5%;
width: 300px;
height: 600px;
border: 1px solid #CF6B08;
border-radius: 3px;
}
#divLogin {
background: #FFCC99;
/* For browsers that do not support gradients */
background: -webkit-linear-gradient(#FAC28A, #FFCC99);
/* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(#FAC28A, #FFCC99);
/* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(#FAC28A, #FFCC99);
/* For Firefox 3.6 to 15 */
background: linear-gradient(#FAC28A, #FFCC99);
/* Standard syntax */
}
.spanTitle {
position: absolute;
top: 10px;
left: 10px;
font-size: 20px;
color: #003399;
font-weight: bold;
}
.inputFirst {
position: absolute;
top: 50px;
margin-left: 5px;
width: calc(100% - 10px);
height: 30px;
}
.divWarningInputFirst {
position: absolute;
width: calc(100% - 10px);
height: 30px;
top: 88px;
margin-left: 5px;
border: 0px solid black;
background-color: #fcdcbb;
color: #ff0000;
font-weight: bold;
padding-top: 5px;
padding-left: 5px;
}
.divWarningInputFirst:after {
content: "";
position: absolute;
top: -5px;
left: 8px;
border-style: solid;
border-width: 0 5px 6px;
border-color: #fcdcbb transparent;
display: block;
width: 0;
z-index: 1;
}
input:focus {
outline: 3px solid #725b44;
}
input {
border-color: transparent;
padding-left: 3px;
box-sizing: border-box;
}
<div id="divMain" class="divMain">
<div id="divLogin" class="divLogin">
<span id="spanTitle" class="spanTitle">Login</span>
<input type="text" id="inputFirst" class="inputFirst" placeholder="input first">
<div id="divWarningInputFirst" class="divWarningInputFirst">Please enter input first</div>
</div>
</div>
This might help you!
You should add 1px instead of 0.1px with outline-style
input:focus {
outline:1px solid #725b44;
}

Google Follow Not Showing

Please help me solve this problem, Google Follow only shows the bubble but not the word "Follow", it seems like the width is automatically set to "0" when I check using Firebug.
Only shows the bubble:
Width=0:
Currently this is the CSS code that I use:
/* header : social
/* ------------------------------------ */
.toggle-social { color: #fff; font-size: 18px; line-height: 24px; cursor: pointer; padding: 13px 20px 13px 20px; display: block; position: absolute; right: 60px; top: -50px;
-webkit-box-shadow: -1px 0 0 rgba(255,255,255,0.1);
box-shadow: -1px 0 0 rgba(255,255,255,0.1);}
.toggle-social:hover,
.toggle-social.active { background: rgba(0,0,0,0.15); color: #fff; }
.social-expand { display: none; background: #26272b; position: absolute; top: 0; right: 58px; width: 320px;
-webkit-box-shadow: 0 1px 0 rgba(255,255,255,0.1);
box-shadow: 0 1px 0 rgba(255,255,255,0.1); }
.social-expand-inner { background: rgba(0,0,0,0.15); font-size: 18px; line-height: 24px; padding: 13px 20px 13px 20px; display: block; position: relative;}
.follow-social {font-size: 1px;}
/* This gets Facebook to fall into place */
.follow-social iframe { vertical-align: middle; }
/* Set an optional width for your button wrappers */
.follow-social span { display: inline-block; width: 90px; }
/* Adjust the widths individually if you like */
.follow-social .followgoogle { width: 75px; }
This is the Google Follow button:
developers.google.com/+/web/follow/
I tried to view it using Google Chrome, it render correctly:
http://s11.postimg.org/i1wh1nudf/work_on_chrome.png
When using Firefox, the problem still exists.