Hi i am creating a ionic app in that need to add a background image in m home page the image size is 1280*698 . in my css i am giving the code like this
#homecontent{
background-image:url('../img/home2.png') !important;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
in my HTML:
<ion-content id="homecontent">
</ion-content>
My problem is the background image is not responsive. how can i do that?Thansk in advance
Make these changes in your CSS:
#homecontent{
background:url('../img/home2.png')no-repeat center center fixed !important;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
You could use:
#homecontent{
background:url('../img/home2.png');
background-repeat:no-repeat;
background-size:contain;
background-position:center;
}
If you want to remain the aspect ratio of your background image or:
#homecontent{
background:url('../img/home2.png');
background-repeat:no-repeat;
background-size:100% 100%;
}
If you background image's should scale oth in height and width
http://www.w3schools.com/cssref/css3_pr_background-size.asp and http://www.w3schools.com/cssref/playit.asp?filename=playcss_background-size&preval=contain