background image size css code example
Example 1: how to cover full image in css
body {
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
Example 2: background image size css
background: url(mountain.jpg);
background-repeat: no-repeat;
background-size: auto;
}
background: url(mountain.jpg);
background-repeat: no-repeat;
background-size: 300px 100px;
}
Example 3: css cover
background-size: cover;
Example 4: how to scale a bg image acc to size of div
/* One way */
background-size: cover;
/* Other option */
background-size: contain;
Example 5: how to change the width of a background image in css
background: url(mountain.jpg);
background-repeat: no-repeat;
background-size: auto;
}
background: url(mountain.jpg);
background-repeat: no-repeat;
background-size: 300px 100px;
}
Example 6: background image height and width
.class{
background: url("../images/icons/map.png") no-repeat center center/50px 50px fixed;
}