views:

56

answers:

5

I find this amusing and really annoying. On windows XP with IE7/8 the input boxes and dropdown boxes are rendered with a thib border and with rounded corners and they look good. I was redesigning our intranet (very messy code) and I started putting <!DOCTYPEs and all the "modern" things like css and so on when I noticed the dropdown box is rendered with a "flat square" style that does not match the textboxes... I put up two simple html pages to show all of you what I mean: test page Thanks for your help...

PS: same behaviour with Chrome and Firefox...

A: 

Try changing the type of !DOCTYPE you're using. For a list of doctypes, check out http://www.w3schools.com/tags/tag_DOCTYPE.asp

bkritzer
A: 

Your HTML is incorrect:

<SELECT style="width:200px"  id=select1 name=select1>

When you don't use a Doctype the browser enters in what's called "Quirks mode" where it tries to make the best of the given code (usually emulating old browsers). When you add a Doctype it goes into "Standards Mode" expecting standards compliant HTML.

The first problem is that you used an XHTML doctype which demands all tags to be lowercase (<select>), the second issue is that you haven't enclosed properties in quotes (id=select1 instead of id="select1") which is probably triggering the error.

Some browsers even have an "Almost standard mode" (like FF)

(Btw, you're already using css with style="width: 200px" :)

Januz
I applied the changes you suggested but nothing changes. The dropdownbox is rendered differently in any case (border style, color, height...)
meco_r
A: 

I can not reproduce your problem with a simple test-case, however for the samples you provided I can see that the width of the select element is being calculated differently. This seems to me to be a Quirks vs Standards mode issue. In Standards mode the browsers implement the spec more rigorously and thus you'll find issues like this often when you switch between them. However for consistent cross-browser results you're usually better off using standards mode (by specifying a doctype).

Mr. Shiny and New
+1  A: 

This is expected behavior, unfortunately. A SELECT's height and width need to be adjusted for the size of the border and the padding of it. So if you want a 100x20 select with a 1px border you will need to set height/width to 100x20 as opposed to most everything else where you would set height/width to 98x18.

Andrew G. Johnson
A: 

I've seen that behavior before as well, and it unbelievably annoying! THe only way I could find to get around it is to make the select box a few pixels wider than the normal textboxes. Not an optimal solution, though, so I hope someone else has a better way. Good luck!

darthnosaj