Input background colour destroys styling?
Sorry - any sort of styling on input elements tends to destroy their OS/browser defaults. The default inputs are rendered in an entirely different way - it's not like they're coded into the browser as CSS styles, unfortunately.
The best thing to do here is, rather than try to make your red-background inputs emulate normal ones, create your own attractive styling! If you like those light borders, use border: 1px #ccc solid
. If you like round corners, take advantage of border-radius
and -moz-border-radius
- for those who are on the edge of browser development, they'll have 'em. For those who aren't, they won't notice the difference.
In short, don't try to make the inputs fit in with the OS environment, but rather style them to your own site's look and feel. This will create better design for your website overall :)
Removing input background colour for Chrome autocomplete?
You can change input box styles as well as text styles inside input
box:
Here you can use any color e.g. white
, #DDD
, rgba(102, 163, 177, 0.45)
.
But transparent
won't work here.
/* Change the white to any color */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active{
-webkit-box-shadow: 0 0 0 30px white inset !important;
}
Additionally, you can use this to change the text color:
/*Change text in autofill textbox*/
input:-webkit-autofill{
-webkit-text-fill-color: yellow !important;
}
Advice: Don't use an excessive blur radius in the hundreds or thousands. This has no benefit and might put processor load on weaker mobile devices. (Also true for actual, outside shadows). For a normal input box of 20px height, 30px ‘blur radius’ will perfectly cover it.
Background color in input and text fields
input[type="text"], textarea {
background-color : #d1d1d1;
}
Hope that helps :)
Edit: working example, http://jsfiddle.net/C5WxK/
Removing input background colour for Chrome autocomplete?
You can change input box styles as well as text styles inside input
box:
Here you can use any color e.g. white
, #DDD
, rgba(102, 163, 177, 0.45)
.
But transparent
won't work here.
/* Change the white to any color */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active{
-webkit-box-shadow: 0 0 0 30px white inset !important;
}
Additionally, you can use this to change the text color:
/*Change text in autofill textbox*/
input:-webkit-autofill{
-webkit-text-fill-color: yellow !important;
}
Advice: Don't use an excessive blur radius in the hundreds or thousands. This has no benefit and might put processor load on weaker mobile devices. (Also true for actual, outside shadows). For a normal input box of 20px height, 30px ‘blur radius’ will perfectly cover it.
Change the color of a input-field when selected
Try with :focus
and go for outline
input[type=text]:focus{ outline: 2px solid orange; /* oranges! yey */}
<input type="text" placeholder="Name...">
changing backgroundColor changes border
Browsers I've tested: Opera 10.70, Firefox 3.6.9, IE 8.0 changes to inset. Webkit (Chrome 5.0.375.70 and Safari 5.0.2) also changes to inset but only when color to set is different than current color.
Every browser has different look of their controls, I call it a default look. You can customize control (e.g. change color of its background), then it changes to, what I call, a customizable look. It changes its properties to standard, editable by CSS, which should look the same on every browser. Default property for border-style of customizable-looking input-type=text is "inset".
Similar mechanism affects customizing scrollbars. If you set a color, scrollbar will be rectangular, because only then it can be colored.
Related Topics
Css3 :Not() Selector to Test Parent's Class
Relative Padding Is Relative to What
Rectangle Border Around Svg Text
CSS Resize Property - Change Resize Icon Properties
Less Importing CSS and Relative Paths
CSS Solution to Hide Div After X Amount of Seconds
What's the Trick to Inspect Popout/Dropdown Menu Style with Firebug
Safari: Vh Units Applied to Parent Element Doesn't Allow 100% Height in Child
Svg Symbols Not Being Displayed in Firefox
Angular Material Mat-Spinner Custom Color
CSS Selector for First Element of Visual (Block Reflow) Row
Max-Width of Img Inside Flexbox Doesn't Preserve Aspect Ratio
Jquery Mobile Android - Fixed Full-Screen Background Image
In the CSS Visual Formatting Model, What Does "The Flow of an Element" Mean
Angular Mat-Select Text Color Doesn't Change