I have used a background image on body to cover full screen but it is partially hidden by container-fluid class from bootstrap3.
body
{
background: url("bg.jpg") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-position: center
}
Screenshot:
Related
i have this for a custom class in my css:
.login-img-body{
background-image: url('../img/loginWallpaper.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
if I use this class on a regular div the image is applied, but if I use the class on a body the image does not appear. the body doesn't have any other classes.
your css is not valid. You should be using background: rather than background-image: if you are using shorthand css.
.login-img-body{
background: url('../img/loginWallpaper.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
I am working in Ionic, I've added a background image in CSS, but when I build the android application there is a white space in place of that background image, how can I solve this error?
CSS code is:
.abc{
background-image: url('/img/s.png') !important;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
Your image should be at a path similar to www/img/background.png.
Make sure that start of your image path has "../" this will point it to the correct image path in your resource folder once the app is built for a device.
To set background image you can try below css.
.scroll-content{
background: url("../img/background.png") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
in some ionic version
.pane{
background: url("../img/background.png") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
If you are using ionic2 then in src/app/app.scss
.scroll-content {
background: url("../../img/background.png") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
or
ion-content{
background: url("../../img/background.png") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
}
I'm upgrading my Ionic App version:
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:
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:
</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. You have to add same css for your scroll content because above css will work only for the screen not for scroll-able screen .
.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;
}
CSS:
body {
background: url("https://wallpaperscraft.com/image/mountain_lake_landscape_trees_79396_2560x1600.jpg");
background-size: cover;
background-repeat: no-repeat;
}
JSFIDDLE: https://jsfiddle.net/rts05xt2/
I want that the image to be full width and full height, and if someone resizes the browser, the image will not resize again, just stay like that. Any suggestions?
You can apply the below CSS :
body {background:url("https://wallpaperscraft.com/image/mountain_lake_landscape_trees_79396_2560x1600.jpg") no-repeat center center fixed; background-size : cover}
html {
background: url(images/ho.png) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
This is the perfect way
I am having trouble here. I got a background image that is 1024x960, and I want it to fit in all type of resolutions, but impressively, it is overextending a bit on all screens.
This is my CSS:
body {
background-image: url("../testes/jogo.bmp");
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
background-color: #464646;
}
I guess there has to be a mistake with the code, but yet every time I read it I feel it's ok but obviously it's not.
Try This :
body {
background: url('../images/background.jpg') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
Frorm the docs:
Cover: Scale the background image to be as large as possible so that the background area is completely covered by the background image. Some parts of the background image may not be in view within the background positioning area
If you want the image to be fully in view, you can use
background-size:contain;
Contain: Scale the image to the largest size such that both its width and its height can fit inside the content area
body {
background-image: url("../testes/jogo.bmp") no-repeat center center fixed;
background-size:cover;
}
you can see here
Try This Code:
body {
background-image: url("http://miriadna.com/desctopwalls/images/max/Natural-dam.jpg");
background-position: center center;
background-repeat: no-repeat;
background-attachment: fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}