background image css fit to div code example
Example 1: css background image fit
body {
background-image: url(images/background.svg);
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
}
Example 2: how to cover full image in css
body {
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
Example 3: how to set a full size background image in html
<head>
<style>
#example1{
border: 2px solid black;
padding: 100px;
background: url(mountain.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
}
</style>
</head>
<body>
<div id="example1">
</div>
</body>