46

Check out http://demo.neeraj.name/admin_data in both Chrome and Firefox. In Firefox the select box has large height. In Chrome the height of select box is very small.

How do I make the select box of chrome and safari look like the select drop down of Firefox?

magi182
  • 3,427
  • 1
  • 15
  • 23
Neeraj Singh
  • 2,116
  • 4
  • 19
  • 24
  • 9
    Please consider changing the correct answer as the one with the highest votes is far more practical. – willdanceforfun Apr 13 '13 at 12:07
  • This question is no longer real. Because you are referring to things that no longer exist. It would have been better if you copied the HTML, CSS and other relevant things into the question text... – Lzh Dec 16 '13 at 12:15
  • Makes sure to scroll down to the very bottom. Unfortunately the best answer is 2nd from last. – Gavin Jun 17 '14 at 13:23
  • try [jqTranform](http://www.dfc-e.com/metiers/multimedia/opensource/jqtransform/). you'll have more control over the form elements. – pixeltocode Mar 31 '10 at 08:09

10 Answers10

147

I've run into this problem before

Setting the height of the select element works fine on webkit in Windows, but fails on webkit on a Mac.

If you set the css attribute

-webkit-appearance: menulist-button;

It will allow the height to work properly on a Mac, but it creates this weird black border on windows. You can adjust the border by setting the css border property, but that changes the look on all browsers that let you style select borders, not just webkit.

At this point, i gave up, but hopefully that is a good starting point if you want to investigate further.

George
  • 36,413
  • 9
  • 66
  • 103
Chi
  • 22,624
  • 6
  • 36
  • 37
34

Increase the line-height.    

Mohammad Areeb Siddiqui
  • 9,795
  • 14
  • 71
  • 113
Praveen Vijayan
  • 6,521
  • 2
  • 29
  • 28
17

height will not work on Safari unless you also have a background set. If you set a background you may lose the drop down arrows in the windows version of Safari. Again form styling seems to be wrought with issues.

Ted
  • 7,122
  • 9
  • 50
  • 76
eggs
  • 331
  • 1
  • 4
  • 10
  • 6
    Setting 'background: none' seems sufficient to make Chrome and Safari respect the height property for select boxes on OSX. Still seems like a hack though. The jQuery combobox solution is probably better long-term. – Anton Dec 01 '12 at 19:25
  • @antonm: I'm not sure how well jQuery combobox works on mobile. – cdmckay Jan 28 '13 at 14:32
  • 1
    @antonm doesn't most of CSS seem like a hack? :) I've accepted the feeling that I'm doing something the wrong way when I'm writing CSS – corbin Apr 25 '13 at 19:34
9

@Chi's answer is correct. Another quick hack is to add a border CSS style:

select { border: 1px solid #CCC }

This both triggers the -webkit-appearance: menulist-button property with the added benefit of removing the ugly black border :).

Chris J
  • 3,828
  • 1
  • 20
  • 17
8

use css border property. make the select border to none or 0. border:none; showing perfectly in chrome and safari in mac os

Praveen
  • 81
  • 1
  • 1
  • Setting the `border:none;` or `border:1px solid #ccc;` seems to turn on the ability to modify the font properties of the input for Mac Chrome/Safari. Strange. – Justin Aug 12 '13 at 18:52
  • Yep I wrote a blog post on it, just add border and you can change the height, font etc. http://webstori.es/normalise-select-html-tags-in-windows-and-mac/ – hcharge Sep 10 '13 at 14:57
  • This also works on Chrome Version 32.0.1700.102 on MacOS similar to Chi's answer with the webkit menu list option. – Joseph Coco Feb 16 '14 at 07:49
2

I used jQuery combobox for this.

With this, you can set the height of the necessary CSS classes to the height you need your select box to be.

markashworth
  • 1,141
  • 10
  • 17
1

You can increase the font-size to help with the height as well. I think that Safari mac show up to 16px font-size. At least gets a larger click region.

estern
  • 175
  • 6
  • 17
1

Use line-height for safari its working.

0

Sample page works Google Chrome 4 and Safari 4

Fatih Hayrioğlu
  • 3,458
  • 1
  • 26
  • 46
0

Simply set the height property. line-height worked in Safari on Windows, but not on Mac. height worked on both.

Tony Pye
  • 31
  • 4