Raymond the Developer
Raymond the Developer

Reputation: 1676

Input field showing different size in iOS

I have an input field with a background and a fixed width/height. It looks good in all the browsers on my desktop. But for some reason it looks bigger on the iPad and iPhone.

I tried several tricks in Css but nothing worked so far.

width: 120px !important;
background-image:url('../img/header-input.png');
height: 30px;
-webkit-appearance: none !important;
-webkit-border-radius: 0;
border-radius:0;
@include border-radius(0);
outline: none;
border: none;

Upvotes: 12

Views: 12321

Answers (3)

Alberto
Alberto

Reputation: 928

Be careful, as far as I know Safari browser in iOS adds extra padding in the input fields.

Try using this code inside your css:

padding: 0;

Upvotes: 31

user2099810
user2099810

Reputation: 381

Add this between your :

<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"> 

and if that doesn't work you can set styles for your phone/tablet using queries:

/* Smartphones (portrait) ----------- */  
@media only screen 
and (max-width : 320px) {
/* Styles */ 
}

/* iPads (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) {
/* Styles */
}

Upvotes: 2

SuRaj Creator
SuRaj Creator

Reputation: 995

add this inside your header

<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"> 

Upvotes: 1

Related Questions