I have a little issue at the moment, the text placeholder in the textbox doesn't seem to be showing when viewing on IOS device but works fine on desktop and android...
This is just a simple div with an input field in it.
This is the code I am using :
<div id="em_inputs" class="hidden clearfix">
<input type="text" name="first_name" id="first_name" placeholder="First Name">
</div>
#mixin Opacity($value){
$IEValue: $value*100;
opacity: $value;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity="+$IEValue+")";
filter: alpha(opacity=$IEValue);
}
#em_inputs{
-webkit-appearance: none;
-webkit-border-radius:0;
border-radius:0;
overflow: hidden;
position: relative;
top: 127px !important;
width: 100%;
input {
overflow: hidden;
-webkit-appearance: none;
-webkit-border-radius:0;
border-radius:0;
border: none;
width: 100%;
padding: 12px 5px 11px 10px;
color: $text-white;
background: url("../img/bg_input.png") repeat 0 0;
margin: 10px 0 0 0;
#include Opacity(0);
position: relative;
top: -10px;
height: 3px;
overflow: hidden;
&:focus{
border: 2px solid $text-white;
}
}
I am also using this code that makes the placeholder text white color in case a browser uses special rules.
::-webkit-input-placeholder {
color: white;
}
:-moz-placeholder { /* Firefox 18- */
color: white;
}
::-moz-placeholder { /* Firefox 19+ */
color: white;
}
:-ms-input-placeholder {
color: white;
}
::-webkit-scrollbar {
display: none;
}
Does someone have any idea what I going on ? I am not only interested in getting the code fixed but also know if someone experienced the same issues with IOS placeholders in general being a bit picky ?
Could it be because of the background image too ?
I found answers.
The text of the placeholder appears when changing the orientation of the device. That is changing the float.
What I do is just before the page fully loads I do a reset of the float and it works.
This is the source that helped me out.
http://www.456bereastreet.com/archive/201301/the_mysterious_webkit_placeholder_overflow_bug/
Related
I have a simple search bar which contain a div and inside that div there is -
input element for text and search button.
<div className="search-box">
<input
type="text"
placeholder={PLACEHOLDER.search}
value={this.state.search}
onChange={this.updateSearchBar}
onKeyUp={this.keyPress}
/>
<IconButton className="search-icon-button" onClick={this.handleSearchIcon}>
<SearchIcon />
</IconButton>
</div>
Css file -
.search-box {
border: 1px solid black;
width: 200px;
height: 30px;
display: flex;
min-width: 180px;
margin-right: 2%;
padding-left: 1px;}
.search-box input{
width: 100%;
color: black;
border: none;
outline: none;
}
.search-icon-button {
color: #FF7D50 !important;
padding: 3px 0px 0px 7px !important;
}
IconButton and SearchIcon are material ui component.
Below I am attaching the screen shot of chrome and mozilla.
Chrome -
Mozilla -
Could you please help I have used width: webkit-mozilla but I want this to work fine on both.
Give browser specific css.You can give padding according to set search icon.I hope it will helps you.
#-moz-document url-prefix(){
.search-icon-button {
color: #FF7D50 !important;
padding: 3px 0px 0px 4px !important;
}
}
I'm trying to do some basic styling in an html range input with the follow:
HTML
<input type="range" min="0" value="50" max="100" step="1" />
CSS
input[type=range]::-webkit-slider-thumb {
-webkit-appearance : none;
background : red;
height : 20px;
width : 20px;
}
I also made a Codepen you can look at.
You'll notice that if you comment out the background, height and width styles the thumb does dissapear. So something is working. But with the styles applied I'd expect it to be a 20px X 20px red square. But alas, I just see the default thumb styling.
Please check with the below answer
input[type=range] {
-webkit-appearance: none;
}
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] {
/* 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]::-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]:focus::-moz-range-track {
background: #ccc;
}
/* for ie */
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" min="0" value="50" max="100" step="1" />
If you are able to edit the track, but NOT the thumb, then be sure that you have -webkit-appearance: none; in these two places to override default behavior.
input[type=range] {
-webkit-appearance: none; <------------------------------------ REQUIRED
}
input[type=range]::-webkit-slider-runnable-track {
background: /* ...change color with background property... */;
/* ...my custom edits...*/
}
input[type=range]:hover::-webkit-slider-runnable-track {
background: /* ...change color with background property... */;
/* ...my custom edits... */
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none; <------------------------------------ REQUIRED
height: /* ..manually set height greater than 0... */ <-------- REQUIRED
width: /* ..manually set width greater than 0... */ <---------- REQUIRED
background: /* ...change color with background property... */;
/* ...my custom edits... */
}
input[type=range]:hover::-webkit-slider-thumb {
background: /* ...change color with background property... */;
/* ...my custom edits... */
}
(Note that this works in Chrome, but you can comma separate other properties like input[type=range]::-moz-range-thumb and input[type=range]::-ms-thumb as needed to account for other browsers)
It would seem the following selector is causing the issue and your styles aren't working because of that, please remove it and the styles will apply:
::-webkit-slider-thumb
Here is an updated Codepen.
Updated Answer
Several styles need to be applied to range inputs in all browsers to override their basic appearance. After declaring the below styles you will be able to style the range toggler.
Please see the below and add it to your code:
input[type=range] {
-webkit-appearance: none; /* Hides the slider so that custom slider can be made */
width: 100%; /* Specific width is required for Firefox. */
background: transparent; /* Otherwise white in Chrome */
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
}
input[type=range]:focus {
outline: none; /* Removes the blue border. You should probably do some kind of focus styling for accessibility reasons though. */
}
input[type=range]::-ms-track {
width: 100%;
cursor: pointer;
/* Hides the slider so custom styles can be added */
background: transparent;
border-color: transparent;
color: transparent;
}
Please see this link to the updated Codepen.
So the issue why the styles didn't get applied to the thumb is that you also have to add
input[type=range] {
-webkit-appearance: none;
}
.. The thumb is now a red square.
Hide the input - this hides thumb and track
Style the thumb as you'd like
Style the track
caveat: the track aligns with the top of the thumb. I used a negative margin to correct this. If someone has a better way of doing this that would be nice...
input[type=range] {
-webkit-appearance: none;
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
background: red;
height: 20px;
width: 20px;
margin-top: -8px;
}
input[type=range]::-webkit-slider-runnable-track {
width: 300px;
height: 5px;
background: #ddd;
}
<input type="range" min="0" value="50" max="100" step="1" />
CODEPEN
Good resource here for ensuring browser compatibility.
Im styling a vertical slider using -moz and -webkit.
With mozilla i declare it vertical using orient="vertical" and all the styling works fine.
With chrome since im using -webkit-appearance: none; for styling i can't use -webkit-appearance: slider-vertical, this forces me to use -webkit-transform: rotate(90deg);
The issue is that in mozilla i can use height to declare the real height of the slider instead by rotating it with chrome i'm forced to use width.
#sens[type=range]{
-webkit-appearance: none;
height: 220px; //in chrome is width since it is rotated
}
How can i solve this?
ok, I think you need something like this.
For first you need to read about ::-webkit-slider-runnable-track and ::webkit-slider-thumb. link1 and link2 very useful properties.
And now you can do that like that:
input[type=range] {
-webkit-appearance: none;
-webkit-transform: rotate(90deg);
margin-top: 50px;
}
input[type=range]::-webkit-slider-runnable-track {
width: 300px;
height: 5px;
background: #ccc;
border: none;
border-radius: 3px;
}
input[type=range]::-webkit-slider-thumb {
-webkit-appearance: none;
border: none;
height: 16px;
width: 16px;
border-radius: 50%;
background: red;
margin-top: -5px;
}
input[type=range]:focus {
outline: none;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: #ddd;
}
<input type="range" />
How can I avoid that there is a dotted selection rectangle around the text when the user clicks the button, see image below. I already tried to add the css rule user-select: none;, which I saw in another question, but this doesn't seem to work.
Any suggestions?
EDIT: The issue only appears in Firefox (tested with version 47.0)
.button {
background-color: #1a1a1a;
border: none;
color: #f8f8f8;
padding: 10px 40px;
text-align: center;
display: inline-block;
font-size: 16px;
border-radius: 4px;
user-select: none;
-webkit-transition-duration: 0.3s;/* Safari */
transition-duration: 0.3s;
}
.button:hover {
background-color: #595959;
/* Green */
color: white;
}
<button class="button">Button</button>
For remove the dotted border in buttons in Firefox:
button::-moz-focus-inner {
border: 0;
}
Simply put this in your CSS :
.yourclass
{
outline:none;
}
Hope it helps.
button.button:focus {
outline: 0;
}
I'd like to apply opacity to the white rectangle on top of the screen (.header) but for some reason the opacity is applied to all the elements (logo and menu items). I tried to play with z-index but that didn't help. How could I fix this? Many thanks
http://jsfiddle.net/ycLqqsgr/1/
body {
background-image: url('http://lorempixel.com/output/sports-q-c-1141-1113-2.jpg');
}
.header {
z-index: 999;
position: absolute;
background: #fff;
opacity: 0.4;
top: 35px;
right: 0;
left: 0;
margin: 0 auto;
width: 90%;
max-width: 1200px;
}
.header-wrapper {
padding: 54px 60px;
}
.header-logo {
position: absolute;
margin-top: -40px;
}
.header_nav {
float: right;
clear: none;
font-family: 'Maven Pro', sans-serif;
font-weight: normal;
}
.header_nav-wrapper {
list-style: none;
}
.header_nav-item {
margin-left: 22px;
float: left;
clear: none;
}
.header_nav-item-a {
color: #474032;
text-decoration: none;
}
.header_nav-item-a:hover {
color: #eee;
}
.header_nav-item-a--btn {
padding: 16px 18px;
border-radius: 5px;
border: 1px solid #474032;
background-color: transparent;
}
.header_nav-item-a--donate {
margin-top: -18px;
}
.header_nav-item-a--btn:hover {
border: 1px solid #eee;
}
That's a common problem. The opacity is applied to all child elements. A workaround is to use rgb color codes. I will give an example with a black background at 0.6 opacity.
/* Fallback for web browsers that don't support RGBa */
background-color: rgb(0, 0, 0);
/* RGBa with 0.6 opacity */
background-color: rgba(0, 0, 0, 0.6);
/* For IE 5.5 - 7*/
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);
/* For IE 8*/
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000)";
Remove the opacity: 0.4 and the background-color:#FFF from .header and instead apply:
.header {
background-color:rgba(255,255,255,0.4);
background-color:rgb(133,231,211);
}
Opacity styles the entire element and its descendants, setting the background color to contain an alpha component fixes this.
Using my translucent color equivalence tool, you can find an appropriate fallback color for browsers which do not support alpha transparency (although today, almost all modern browsers have support for this feature, if they don't, it's likely your site will appear broken regardless). Simply mix white with 0.4 opacity against your green background and you'll be able to reasonably simulate a translucent color.
I don't have access to your background image color, but given it's roughly lime-colored, my tool figured an appropriate fallback of:
rgb(133,231,211)