I recently built an app, but after deployment, I noticed that Safari seems to be loading css differently. Everywhere I have a type="button", safari adds an odd white box around the element. It looks terrible. I've looked around on the internet and found this:
input[type="text"],
input[type="button"] {
-webkit-appearance: none;
-webkit-border-radius: 0;
}
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
It's the closest I've come to finding a solution, but it doesn't work.
Site: timetrackers.net
I'm guessing you're talking about Safari's default :focus styling.
You can use this CSS to get rid of it:
input[type="text"]:focus,
input[type="button"]:focus {
outline-width: 0;
}
Related
My website renders well on the iPhone/Safari browser, with one exception: My text input fields have a weird rounded style which doesn't look good at all with the rest of my website.
Is there a way to instruct Safari (via CSS or metadata) not to round the input fields and render them rectangular as intended?
On iOS 5 and later:
input {
border-radius: 0;
}
input[type="search"] {
-webkit-appearance: none;
}
If you must only remove the rounded corners on iOS or otherwise for some reason cannot normalize rounded corners across platforms, use input { -webkit-border-radius: 0; } property instead, which is still supported. Of course do note that Apple can choose to drop support for the prefixed property at any time, but considering their other platform-specific CSS features chances are they'll keep it around.
On legacy versions you had to set -webkit-appearance: none instead:
input {
-webkit-appearance: none;
}
input -webkit-appearance: none; alone does not work.
Try adding -webkit-border-radius:0px; in addition.
It is the best way to remove the rounded in IOS.
textarea,
input[type="text"],
input[type="button"],
input[type="submit"] {
-webkit-appearance: none;
border-radius: 0;
}
Note: Please don't use this code for the Select Option. It will have problem on our select.
The accepted answer made radio button disappear on Chrome. This works:
input:not([type="radio"]):not([type="checkbox"]) {
-webkit-appearance: none;
border-radius: 0;
}
For me on iOS 5.1.1 on a iPhone 3GS I had to clear the styling of a search field and the set it to the style intended
input[type="search"] {-webkit-appearance: none; border-radius: 0 3px 3px 0;}
Doing -webkit-border-radius: 0; alone did not clear the native styling. This was also for a webview on a native app.
Here is the complete solution for Compass (SCSS):
input {
-webkit-appearance: none; // remove shadow in iOS
#include border-radius(0); // remove border-radius in iOS
}
I had the same problem but only for the submit button. Needed to remove the inner shadow and rounded corners -
input[type="submit"] { -webkit-appearance:none; -webkit-border-radius:0; }
If you use normalize.css, that stylesheet will do something like input[type="search"] { -webkit-appearance: textfield; }.
This has a higher specificity than a single class selector like .foo, so be aware that you then can't do just .my-field { -webkit-appearance: none; }. If you have no better way to achieve the right specificity, this will help:
.my-field { -webkit-appearance: none !important; }
I used a simple border-radius: 0; to remove the rounded corners for the text input types.
Please Try This one:
Try Adding input Css like this:
-webkit-appearance: none;
border-radius: 0;
In order to render the buttons properly on Safari and other browsers, you'll need to give a specific style for the buttons in addition to setting webkit-appearance to none, e.g.:
border-radius: 0;
-webkit-appearance: none;
background-image: linear-gradient(to bottom, #e4e4e4, #f7f7f7);
border: 1px solid #afafaf
I used css to style my select arrow, and it's displaying how I want it to in chrome. However, in internet explorer, it is displaying both the default arrow AND my restyled arrow. I'm fine with displaying either one in internet explorer, but not both. Any idea how to keep it as is in chrome, but change it to one or the other in internet explorer?
Here's my css:
select{
background: url(data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0Ljk1IDEwIj48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6I2ZmZjt9LmNscy0ye2ZpbGw6IzQ0NDt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPmFycm93czwvdGl0bGU+PHJlY3QgY2xhc3M9ImNscy0xIiB3aWR0aD0iNC45NSIgaGVpZ2h0PSIxMCIvPjxwb2x5Z29uIGNsYXNzPSJjbHMtMiIgcG9pbnRzPSIxLjQxIDQuNjcgMi40OCAzLjE4IDMuNTQgNC42NyAxLjQxIDQuNjciLz48cG9seWdvbiBjbGFzcz0iY2xzLTIiIHBvaW50cz0iMy41NCA1LjMzIDIuNDggNi44MiAxLjQxIDUuMzMgMy41NCA1LjMzIi8+PC9zdmc+) no-repeat 100% 50%;
-moz-appearance: none;
-webkit-appearance: none;
-webkit-border-radius: 0px;
appearance: none;
outline-width: 0;
}
This is how it looks in chrome:
This is how it looks in internet explorer:
Update, using schylake's fix below - default arrow has disappeared, but would like the custom arrow moved to the right:
The appearance is not supported in IE. refer to this for more information about it.
https://www.w3schools.com/cssref/css3_pr_appearance.asp
The reason it works in chrome is because of this line
-webkit-appearance
This will work on IE10+. Found this while researching the same issue
select::-ms-expand {
display: none;
}
Browsers have added additional functionality/styling to input[type=number] in the form of up and down buttons.
I was able to remove this styling in Chrome since we're able to view the shadow DOM and figure out an element's corresponding identity.
However, Firefox is another story. Is anybody aware of any way to remove the up and down buttons on input[type=number] in Firefox?
I came across this post, but the extension wasn't sufficient.
/* For Firefox */
input[type='number'] {
-moz-appearance:textfield;
}
/* Webkit browsers like Safari and Chrome */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
until safari 5.1 and maybe 6.0 it was possible to hide the slider-thumb via css
input[type=range].onoff::-webkit-slider-thumb,
input[type=range].onoff::-moz-slider-thumb,
input[type=range].onoff::slider-thumb {
-webkit-appearance: none !important;
-moz-appearance: none !important;
appearance: none !important;
height:20px; width:20px;
background-color:transparent;
}
worked also in chrome, ff and opera.
now with safari 6.1 and 6.1.1, firefox 25
this css is not hiding the slider-thumb anymore.
what did i miss?
is there a better, more valid code i could use to hide just the thumb?
no jquery solutions please, i work on a native javascript plugin to add touchable audio-wheels, working in different environments. maybe later i will translate this to jQ too.
okay testet..
looks like, the comma separated list of selectors and setting them all ot once is not working anymore. so valid code can be..
input[type=range].onoff::-webkit-slider-thumb {
-webkit-appearance: none;
}
input[type=range].onoff::-moz-slider-thumb {
-moz-appearance: none;
}
input[type=range].onoff::slider-thumb {
appearance: none;
}
but still in FF i can't hide the thumb, how?
My website renders well on the iPhone/Safari browser, with one exception: My text input fields have a weird rounded style which doesn't look good at all with the rest of my website.
Is there a way to instruct Safari (via CSS or metadata) not to round the input fields and render them rectangular as intended?
On iOS 5 and later:
input {
border-radius: 0;
}
input[type="search"] {
-webkit-appearance: none;
}
If you must only remove the rounded corners on iOS or otherwise for some reason cannot normalize rounded corners across platforms, use input { -webkit-border-radius: 0; } property instead, which is still supported. Of course do note that Apple can choose to drop support for the prefixed property at any time, but considering their other platform-specific CSS features chances are they'll keep it around.
On legacy versions you had to set -webkit-appearance: none instead:
input {
-webkit-appearance: none;
}
input -webkit-appearance: none; alone does not work.
Try adding -webkit-border-radius:0px; in addition.
It is the best way to remove the rounded in IOS.
textarea,
input[type="text"],
input[type="button"],
input[type="submit"] {
-webkit-appearance: none;
border-radius: 0;
}
Note: Please don't use this code for the Select Option. It will have problem on our select.
The accepted answer made radio button disappear on Chrome. This works:
input:not([type="radio"]):not([type="checkbox"]) {
-webkit-appearance: none;
border-radius: 0;
}
For me on iOS 5.1.1 on a iPhone 3GS I had to clear the styling of a search field and the set it to the style intended
input[type="search"] {-webkit-appearance: none; border-radius: 0 3px 3px 0;}
Doing -webkit-border-radius: 0; alone did not clear the native styling. This was also for a webview on a native app.
Here is the complete solution for Compass (SCSS):
input {
-webkit-appearance: none; // remove shadow in iOS
#include border-radius(0); // remove border-radius in iOS
}
I had the same problem but only for the submit button. Needed to remove the inner shadow and rounded corners -
input[type="submit"] { -webkit-appearance:none; -webkit-border-radius:0; }
If you use normalize.css, that stylesheet will do something like input[type="search"] { -webkit-appearance: textfield; }.
This has a higher specificity than a single class selector like .foo, so be aware that you then can't do just .my-field { -webkit-appearance: none; }. If you have no better way to achieve the right specificity, this will help:
.my-field { -webkit-appearance: none !important; }
I used a simple border-radius: 0; to remove the rounded corners for the text input types.
Please Try This one:
Try Adding input Css like this:
-webkit-appearance: none;
border-radius: 0;
In order to render the buttons properly on Safari and other browsers, you'll need to give a specific style for the buttons in addition to setting webkit-appearance to none, e.g.:
border-radius: 0;
-webkit-appearance: none;
background-image: linear-gradient(to bottom, #e4e4e4, #f7f7f7);
border: 1px solid #afafaf