Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS forces rounded corners and glare on inputs

Tags:

css

forms

ios

iOS devices add a lot of annoying styles on form inputs, particularly on input[type=submit]. Shown below are the same simple search form on a desktop browser, and on an iPad.

Desktop:

Desktop

iPad:

iPad

The input[type=text] uses a CSS box shadow inset and I even specified -webkit-border-radius:none; which apparently gets overridden. The color and shape of my input[type=submit] button gets completely bastardized on the iPad. Does anyone know what I can do to fix this? Thanks in advance.

like image 283
inorganik Avatar asked Sep 29 '11 15:09

inorganik


3 Answers

The version I had working is:

input {
    -webkit-appearance: none;
}

In some webkit browser versions, you may also be faced with the border-radius still being in place. Reset with the following:

input {
    -webkit-border-radius:0; 
    border-radius:0;
}

This can be extended to apply to all webkit styled form components such as input, select, button or textarea.

In reference to the original question, you wouldn't use the value 'none' when clearing any unit based css element. Also be aware that this hides checkboxes in Chrome, so perhaps use something like input[type=text] or input[type=submit], input[type=text] or instead filter out those that don't use rounded corner settings such as input:not([type=checkbox]), input:not([type=radio]).

like image 159
marksyzm Avatar answered Nov 11 '22 23:11

marksyzm


You can get rid of some more webkits form, input, etc. styling with this:

input, textarea, select {
   -webkit-appearance: none;
}
like image 30
nick Avatar answered Nov 11 '22 21:11

nick


For the submit button don't use:

<input type="submit" class="yourstylehere" value="submit" />

Instead use the button tag:

<button type="submit" class="yourstylehere">Submit</button>

This worked for me.

like image 3
Digital Robot Gorilla Avatar answered Nov 11 '22 21:11

Digital Robot Gorilla