简体   繁体   English

离子背景图片:中心无法在Android上运行

[英]Ionic Background image : center not working on Android

I'm upgrading my Ionic App version: 我正在升级我的Ionic App版本:

ionic: ionic-bower#1.2.4
ionic-platform-web-client": ^0.7.1
cordova: 6.1.1

And after the upgrade the background image is not centered, my CSS code is: 升级后,背景图片未居中,我的CSS代码为:

body {
    background:url('../img/splash.png') rgb(227,227,213) no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

And my body html only is: 而我的身体html仅是:

</head>
 <body ng-app="starter">
   <ion-spinner></ion-spinner>
</body>`

Is a possible bug of Ionic? 是离子的可能错误? What Am I doing wrong? 我究竟做错了什么?

I had a problem with it too and found this link 我也有问题,找到了此链接

So here is the solution for how to add background for all size of devices in hybrid application.So you have to add the following to CSS to your style.css. 因此,这是如何在混合应用程序中为所有大小的设备添加背景的解决方案。因此,您必须将以下CSS添加到style.css中。 You have to add same css for your scroll content because above css will work only for the screen not for scroll-able screen . 您必须为滚动内容添加相同的CSS,因为上述CSS仅适用于屏幕,而不适用于可滚动屏幕。

 .BackgroundImage{ background: url(image.jpg) no-repeat center center fixed; -webkit-background-size: contain; -moz-background-size: contain; -o-background-size: contain; background-size:contain; } .scroll-content{ background: url(image.jpg) no-repeat center center fixed; -webkit-background-size: contain; -moz-background-size: contain; -o-background-size: contain; background-size:contain; } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM