The div height can be set using the css height or (by default) the height of its children. Since images are set as background images, the div cannot determine the height from which it should be, and there is no pure CSS method to adjust the height of the div to fit the size of the background image. What you can do is set the background images to be placed in the center of the div and have the background size as the cover:
.pattern-container .pattern { background-size: cover; background-position: 50% 50%; }
Positioning background images as 50% 50% vertically and horizontally centers it in the containing div regardless of the size of the div. However, the image itself may be cropped around the edges if the aspect ratio of the div is less than the aspect ratio of the image (for example, if the div is 30 pixels wide and 10 pixels high, and the image has 40 pixels wide and 10 pixels high, then the image will lose 5 pixels on both sides).
source share