1body {
2 background-image: url(images/background.svg);
3 background-size: cover; /* <------ */
4 background-repeat: no-repeat;
5 background-position: center center; /* optional, center the image */
6}
1html {
2 background: url(images/bg.jpg) no-repeat center center fixed;
3 -webkit-background-size: cover;
4 -moz-background-size: cover;
5 -o-background-size: cover;
6 background-size: cover;
7}
1#example1 {
2 background: url(mountain.jpg);
3 background-repeat: no-repeat;
4 background-size: auto;
5}
6
7#example2 {
8 background: url(mountain.jpg);
9 background-repeat: no-repeat;
10 background-size: 300px 100px;
11}
1body {
2 background-position: center;
3 background-repeat: no-repeat;
4 background-size: cover;
5}
1<head>
2<style>
3#example1{
4 border: 2px solid black;
5 padding: 100px;
6 background: url(mountain.jpg);
7 background-repeat: no-repeat;
8 background-size: 100% 100%;
9}
10</style>
11</head>
12<body>
13<div id="example1">
14</div>
15</body>