I\'m trying to do something pretty simply; change the border colour of an input. In both IE11 and latest stable Chrome, changing the color also changes how it looks (appears
This is the simplest way I can find of fixing the problem. Unfortunately, it involves changing the height CSS. Crazy, I know, just for a border color change!
<input type="text" value="Default" />
<input type="text" style="border: 1px #cecece solid; padding: 2px; height: 16px;" />
http://jsfiddle.net/S2TxT/10/
add class to the input : html :
<input class="border" />
css:
.border { border: 1px solid #ffffd; /*you can write your hex code for color replacing #ffffd*/}
you can use border-width and height attribute(border-width:thin)
<input id="tdfre" style="border-color:red;border-width:thin;height:18px;padding:1px;" type="text"/><input type="text">
Use the below CSS:
input{
-moz-appearance:none;
-webkit-appearance:none;
appearance:none;
border:1px solid grey;
}
input:last-child{
border-color: red;
}
Note that different browsers apply different default styles to elements which can go against your expectations.
You may want to look at using something like CSS Reset so you can more easily anticipate the results applying your CSS across all browsers.
You can also look at applying appearance:none;
to your input
elements to override browser specific styling directly.
Have a look HERE for a more comprehensive fiddle.
In IE11 and Chrome, this got me matching boxes.
As for why... browsers will be browsers?
<input type="text" value="Default" />
<input type="text" value="Default" style="padding: 2px 1px; border: 1px solid red" />
http://jsfiddle.net/S2TxT/11/
EDIT
After further investigation, it becomes apparent why this might happen: http://jsfiddle.net/S2TxT/18/
I would recommend inspecting the CSS being applied to those input elements using FireBug lite.
http://getfirebug.com/firebuglite
Most browsers set their own CSS as default for input boxes and it's annoyingly convoluted to say the least. Goole chrome for instance, sets an inset border and then overrides it some places in different ways depending on the side of the input box.
If you look in the Inspect Element Computed CSS box for the input element, you will see what is applied and see how to overide it.