I am currently developing a form and today, I came across the following problem: All (or rather most) of my form elements are supposed to have a width of 50% of their parent. There is also a border and a padding that (since I’m using XHTML) will make the element a little bigger in total. No problem. However, when I try to put a <select>, the browser makes it a little smaller. To me, it looks like 50% minus padding minus border. This is not expected behavior since it’s pretty much quirks-mode behavior.
That’s pretty fascinating actually. I’ve never noticed that before but yes, clearly, the select element is getting rendered differently despite them all being blocks and a width set. The select is getting set to 344px in width and all the rest 350px. 350px is correct. I’m stumped, but I’m also deliriously tired :D . I think if it was vitally important to me and it was a fixed width environment I’d just force it to be right with a little inline styling.
I investigated a little more today… And came to the following conclusion: All browsers (except IE8) are doing it wrong, so it’s certainly not a bug, it must be a feature! :lol:
Mozilla Developer Center claims the different behavior is "to emulate the behavior of browsers that do not correctly support the CSS box model specification". Nice way to express that IE is stupid. However, there are several CSS properties (every browser is using a different one, of course) that influence the different behavior.