3 posts in total

Helpers

Posts tagged

Dynamic Full Page Background Images in Rails

by Syed Aslam · 2 min read

Easy way to set a background from a selected number of images in Rails. You can set a background image purely through CSS thanks to the 'background-size' property in CSS3. Using the `html` element is better than `body` as it's always at least the height of the browser window. You set a fixed and centered background on it, then adjust it's size using `background-size` set to the cover keyword.