93.8k views
3 votes
Which of the following property/value pairs will ensure that the background image of the div in the code below will scale proportionally while filling the entire div? div { background-image: url('#'); background-repeat: no-repeat; background-position: center; / ? /} MCQ Options:

a. background-size: contain;
b. background-size: cover;
c. background-size: auto;
d. background-size: 100% 100%;

User Cweiske
by
7.9k points

1 Answer

6 votes

Final answer:

The property/value pair that will ensure the background image of the div scales proportionally while filling the entire div is background-size: cover;

Step-by-step explanation:

The property/value pair that will ensure the background image of the div scales proportionally while filling the entire div is background-size: cover;.

This property value scales the background image to fill the entire div, while also maintaining the aspect ratio. It ensures that the image covers the entire background area, without any gaps or stretching.

For example, if you have a square div and a rectangular background image, the image will be cropped to fit the square div while maintaining its proportions.

User Nitesh Agarwal
by
8.6k points