tags:

views:

37

answers:

2

If I have 2 input fields with no CSS, and then I add ONLY a background color to one, it changes the look of that field completely. It seems to change at minimum, the height, the border, the border-style and the border color.

I know I can change the CSS for all the input fields to make them match. But does anyone know what the CSS is for the default settings of an input text field? I like the way it looks and I have to match many that have no CSS.

example:

<style type="text/css">
#b {
  background-color: #FFF;
}

</style>
</head>
<body>

<form>
<input id="a" type="text" />
<input id="b" type="text" />
</form>
</body>
+4  A: 

This is entirely browser and OS dependent, every browser has a different default style for input elements and will react differently when applying extra styles. For consistent cross-browser input elements you need to style every aspect of the element (at the very least borders, background and padding).

deceze
I was afraid that was the answer. Thanks
sdfor
That's why a lot of people use CSS resets to ensure that you're starting with the same baseline styles for all elements.
Lèse majesté
ah, thanks I see that now.
sdfor
+1  A: 

Welcome to the css resets world.

I found that it is simply a must for a web site to hav some reset rules, in order to stop all those quirks and different default values of certain elements.

The one im using is this one.

GaVrA
thanks makes a lot of sense, thanks
sdfor