Full Screen Background Image Css Code Example


Example 1: set background image full screen css


#mainBackground{
width: 100%;
height: 100%;
max-height: 100%;
margin: 0;
padding: 0;
background-image: url("https://images.unsplash.com/photo-1487058792275-0ad4aaf24ca7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80");
background-size:100% 100%;
background-repeat: no-repeat;

}
html, body {
height: 100%;
margin: 0;
padding: 0;
}

Example 2: css background image cover center


html { 
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

Example 3: how to cover full image in css


body {
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}

Example 4: background image css fill screen


.Background {
background-image: url("Your picture name.jpg");
background-repeat: no-repeat;
height: 100%;
background-position: center;
background-size: cover;
}

Example 5: how to fit background image in html


/* To make an Image fit the Screen*/


METHOD - 1

html
{
background: url(images/yourImage.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

METHOD - 2

IMP: To make sure that the image covers the whole screen,
you must apply **height: 100%** to both <html> and <body>:

body, html
{
height: 100%;
}

Example 6: css full cover background image


body { 
background: url(path/to/bg-image.jpg) no-repeat center center fixed;
background-size: cover;
}

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable