Skip to content

Instantly share code, notes, and snippets.

@lachlanhardy
Last active August 29, 2015 14:23
Show Gist options
  • Save lachlanhardy/cd2ef5b2889f152d9959 to your computer and use it in GitHub Desktop.
Save lachlanhardy/cd2ef5b2889f152d9959 to your computer and use it in GitHub Desktop.
Ugly media queries to handle input positioning in iOS
/*
In desktop browsers, an email input and a submit input line up neatly against each other and are the same height.
(there's obviously whole reams of other related code)
In iOS, I've had to nudge the second input to make them align. Any suggestions for making this more elegant or not doing it at all?
*/
/** Device specific stylings (probably) **/
@media screen and
(-webkit-device-pixel-ratio: 1), /* non-Retina iDevices */
(orientation : landscape) and
(-webkit-device-pixel-ratio: 2), /* landscape iPhone 5 */
(orientation : landscape) and
(-webkit-device-pixel-ratio: 3){ /* landscape iPhone 6 Plus */
input[type=submit] {height: 4.4em; left: -0.2em; position: relative;}
/* end landscape iPhone 5 + landscape 6 Plus + non-retina iDevices */}
@media screen and
(min-device-width: 768px) and
(max-device-width: 1024px) and
(-webkit-min-device-pixel-ratio: 2) {/* Retina iPad */
input[type=submit] {height: 4.48em; left: -0.2em; position: relative; top: 0.1em;}
/* end Retina iPad */}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment