在 Cordova 中使用一张大图片作为背景还是多张图片?
Use one big image for background or multiple ones in Cordova?
我正在为 iOS 和 Android 构建一个 Cordova 应用程序,因此自然会有很多不同的屏幕尺寸。
我的一些观点有完整的背景图片。我的问题是:
是使用一个大图像来覆盖最大的潜在设备并仅将其用于所有设备,还是使用大量不同的图像使用媒体查询将每个图像分配给正确的设备?
只是在这里寻找最佳实践。
你有办法使用该图像作为图案吗?这样做你不会有不同屏幕尺寸的问题。
我建议使用 2732 x 2048 的图像(最大 iPad screen size today) combined with cover, percentage, or viewport 背景 css 大小。例如:
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>
我正在为 iOS 和 Android 构建一个 Cordova 应用程序,因此自然会有很多不同的屏幕尺寸。
我的一些观点有完整的背景图片。我的问题是:
是使用一个大图像来覆盖最大的潜在设备并仅将其用于所有设备,还是使用大量不同的图像使用媒体查询将每个图像分配给正确的设备?
只是在这里寻找最佳实践。
你有办法使用该图像作为图案吗?这样做你不会有不同屏幕尺寸的问题。
我建议使用 2732 x 2048 的图像(最大 iPad screen size today) combined with cover, percentage, or viewport 背景 css 大小。例如:
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>