Complete the code to set a background image for the body element.
body {
background-image: [1];
}The background-image property requires a url() value to set an image as the background.
Complete the code to make the background image cover the entire element.
div {
background-image: url('photo.png');
background-size: [1];
}repeat which tiles the image instead of scaling.contain which fits the whole image but may leave empty space.The background-size: cover; makes the image cover the entire element area, cropping if needed.
Fix the error in the code to correctly set a background image that does not repeat.
.header {
background-image: url('header.jpg');
background-repeat: [1];
}repeat which repeats the image.repeat-x or repeat-y which repeat only horizontally or vertically.To prevent the background image from repeating, use background-repeat: no-repeat;.
Fill both blanks to set a background image that is centered and fixed when scrolling.
section {
background-image: url('pattern.png');
background-position: [1];
background-attachment: [2];
}scroll which makes the background move with the page.top left which places the image at the top left corner.background-position: center; centers the image.background-attachment: fixed; keeps the image fixed when scrolling.
Fill all three blanks to create a background image that covers the element, does not repeat, and is fixed.
.banner {
background-image: url('banner.jpg');
background-size: [1];
background-repeat: [2];
background-attachment: [3];
}contain which may leave empty space.no-repeat causing the image to tile.scroll instead of fixed.background-size: cover; scales the image to cover the element.background-repeat: no-repeat; stops tiling.background-attachment: fixed; keeps the image fixed during scroll.