Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Dropdown (Select) CSS

I'm currently writing some stylesheets for mobile browsers and have come across a strange issue in the Android browser. When changing the font-size CSS attribute of a text box the box gets bigger to accomodate the larger text. Doing this on a select box however does not change the size of the select box, but the text still gets larger (actually overlapping the top and bottom of the rendered form element).

Can anyone tell me if it's possible to increase the height of select boxes in the Android browser. Or if not point me in the direction of a list of CSS attributes that can be applied to them.

Thanks.

like image 872
ROGUE Avatar asked Aug 17 '09 15:08

ROGUE


4 Answers

Another option you can use (tested on galaxy S running android version 2.1-update1):

select {
    -webkit-appearance: listbox;
}
select, input {
    width: 100%;
    height: 40px;
    line-height:40px;
    border: 1px solid #999;
    border-radius: 6px;
    margin-bottom:10px;
}

This way the inputs and selects all look the same, clicking the select will open the options menu as usual.

like image 120
Dror Avatar answered Nov 13 '22 12:11

Dror


This seems to be a browser bug. You can also reproduce it when you set your browser's text size to 'huge' (in settings). I added a new issue and suggest a workaround with a custom background image for now:

<select style="background: url('big-select-bg.png')"/>
like image 28
Josef Pfleger Avatar answered Nov 13 '22 12:11

Josef Pfleger


try this one:

select{

    -webkit-appearance: menulist-text;
}
like image 4
ali mokrani Avatar answered Nov 13 '22 14:11

ali mokrani


Set the opacity of the select control to 0

Then place a span contorl styled to look like a textbox behind the select control so that the select control are sits directly on top of the span.

The user won't see the select control but when the user attemps to enter text into the span the dropdown options for the select control will appear.

After the user makes their selection use javascript to update the innerHTML of the span with the value of the select control.

Make sure the dimensions of the span and the select control line up well. (Do not use an actual texbox control)

mealaroni.com

like image 1
Bjhamltn Avatar answered Nov 13 '22 13:11

Bjhamltn