views:

474

answers:

5

Since switching to Windows 7, we've noticed that several of our web pages have slight differences. It mostly shows when looking at form elements (text inputs & submit buttons). They are slightly larger/smaller by a few pixels. This seems to be browser independent - we get the same rendering issues using IE8, FF3.5, and Chrome in Windows 7. When switching to the same browser in a Windows Vista environment, the issue disappears.

What's going on? Why would an OS affect HTML/CSS elements? Am I missing something very obvious here or is something strange going on?

Here's a specific example:

HTML:

<input id="input-search" type="text" name="thesearch" value="" />
<button id="btn-search" type="submit" name="search">Search</button>

CSS:

#input-search {
    float:left;
    font-size:18px;
    color:#5b5b5b;
    margin:2px 4px 0 0;
    width:200px;
}
#btn-search {
        background:url(/images/btn_search.png) no-repeat top left transparent;
        padding:5px 0px 6px 20px;
}
A: 

It shouldnt, Are you running one in compatibility mode?

Pino
Exactly what I thought but, no - running both windows 7 and the browsers in their default modes.
Alex
I think it should. Browsers use OS controls for default buttons.
Nosredna
Nosredna: No, browsers render all controls themselves (excluding older IE versions and `<select>`). They just happen to look approximately natively (in case of FF with the Windows classic look that's a *very* rough approximation).
Joey
OK. Point taken.
Nosredna
+5  A: 

Input elements are rendered natively by the browser, and adhere to the OS's standard settings. So as long as you're talking about normal buttons, selects, and checkboxes, I think this is normal. The UI has changed, and accordingly, the style guides for rendering controls.

You can style those elements yourself, with limitations. You should be able to define a fixed size for the text labels of all controls at any rate. However if you define relative sizes, they might render differently due to different OS text size settings. I have noticed that Windows 7 is much more flexible in that respect.

Pekka
+1  A: 

Are you defining sizes for the input elements? If not there is no guarantee how they are rendered and that's entirely browser- or system-dependent.

Joey
+15  A: 

Default buttons are affected by Windows Themes. You'll notice your buttons change if you switch between "classic" Windows and the "Silver" theme even within Windows XP, for example. You can get around this by using CSS to style the buttons.

epalla
Alex
In my experience, setting the width/height with a background image for a button has provided consistent results across browsers and operating systems. Without some testing, however, I can't say whether box model issues of certain browsers affect default button styles. Frankly, I'm a little surprised you're seeing a difference when you have the background image set in the example from the edit.
epalla
+1  A: 

If you're speaking about how the different items actually are created in Windows 7, you might want to take in account that the system maybe using different default system fonts for items. IE8 on Windows 7 is not exactly the same as on Vista or XP so it could possibly be rendering those items just a little bit different.

Chris