I'm building a Cordova app for both iOS and Android so naturally there are a lot of different screen sizes.
Some of my views have a full background image. My question is:
Is is better to use one big image that will cover the largest potential device and just use that for all devices, or use a lot of different images assigning each one to the right device using media queries?
Just looking for best practice here.
I recommend using an image that is 2732 x 2048 (largest iPad screen size today) combined with cover, percentage, or viewport background css sizing. For example:
http://play.ionic.io/app/094f73be9047
css
ion-content {
background-image: url(https://upload.wikimedia.org/wikipedia/commons/6/6c/Keeny-creek-wv-autumn-waterfall-scenery_-_West_Virginia_-_ForestWander.jpg);
background-size: cover;
text-align: center;
}
ion-content p {
padding: 20px 0;
color: white;
font-weight: 100;
font-size: xx-large;
}
html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<link href="https://code.ionicframework.com/1.0.0/css/ionic.min.css" rel="stylesheet">
<script src="https://code.ionicframework.com/1.0.0/js/ionic.bundle.js"></script>
</head>
<body ng-app="app">
<ion-pane>
<ion-header-bar class="bar-positive" class="bar-stable">
<h1 class="title">Awesome App</h1>
</ion-header-bar>
<ion-content class="padding">
<p>I am so beautiful</p>
<button class="button button-positive">I'm a button</button>
</ion-content>
</ion-pane>
</body>
</html>