CSS: Stretch background to page size
by admin on Jan.29, 2023, under News
The following is a quick example on how to stretch a background image to the actual page size in pure CSS.
Unlike stretching the width/height 100% each, this method will scale fine, also on mobile devices:
background: url(images/bg.jpg) no-repeat center center fixed; background-size: cover;
Works great on all modern browsers.