Make Retina display ready for input submit button with image

Read Time:53 Second

When use input[type=image] for form submission, the image is stretched when use Retina Display mobile. Since you cannot change ‘src’ attribute using CSS, I had to find another way to accomplish this.

Someone said to use ‘content’ in CSS can do, but I failed. And this method is not browser compatible.

Anyway, you can make input image to use bigger size in Retina display using only CSS.

<div id="login">
<input type="submit"  id="login_button" name="login_button" class="login_button" value="Sign in" />

<style type="text/css">
#login .login_button{
	background : url(login_button.png) no-repeat center center ;
	background-size: 100%;
	border : none;
	color : transparent;
	width: 100px;
	height: 20px;

only screen and (-webkit-min-device-pixel-ratio: 2), 
only screen and (min-resolution: 192dpi) {  
    /* Retina-specific stuff here */

    #login .btn-login{
   		background : url(login_button@2x.png) no-repeat center center;
   		background-size: 100%;



Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.