# Random Background Image

**URL:** <https://forums.realmacsoftware.com/t/random-background-image/56202>\
**Category:** Elements\
**Created:** [May 19, 2026, 9:29am UTC](https://forums.realmacsoftware.com/t/random-background-image/56202 "2026-05-19T09:29:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnhiggins](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/johnhiggins/32/33610_2.png) [@johnhiggins](https://forums.realmacsoftware.com/u/johnhiggins)\
**Post date:** [May 19, 2026, 9:29am UTC](https://forums.realmacsoftware.com/t/random-background-image/56202/1 "2026-05-19T09:29:27Z")

</div>

I am using a container component to display a full page background image.

I would like to load up a background image randomly on page load from 1 of 3 images.

Is this possible?

---

<div class="post-metadata">

**Author:** ![WeaverPixel](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/weaverpixel/32/25453_2.png) [@WeaverPixel](https://forums.realmacsoftware.com/u/WeaverPixel)\
**Post date:** [May 19, 2026, 10:39am UTC](https://forums.realmacsoftware.com/t/random-background-image/56202/2 "2026-05-19T10:39:45Z")

</div>

Hi @johnhiggins  
Out of the box without additional code I would not know a way to do it. But there ia a Component available which shoul do the job. Look at it here: [Random Content](https://store.elementsapp.io/components/random-content)

---

<div class="post-metadata">

**Author:** ![upssjw](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/upssjw/32/26063_2.png) [@upssjw](https://forums.realmacsoftware.com/u/upssjw)\
**Post date:** [May 21, 2026, 11:15am UTC](https://forums.realmacsoftware.com/t/random-background-image/56202/3 "2026-05-21T11:15:05Z")

</div>

@johnhiggins

[https://forums.realmacsoftware.com/t/cms-random-image-links/56234/3?u=upssjw](https://forums.realmacsoftware.com/t/cms-random-image-links/56234/3)

You do this with CMS, setup is fairly simple, currently not working in the latest update, Elements moved to CMS 2, but should in the next update 🤞

[https://forums.realmacsoftware.com/t/elements-cms-2-is-here/56224/60?u=upssjw](https://forums.realmacsoftware.com/t/elements-cms-2-is-here/56224/60)

There a 3 examples in the project, 3 and 5 images but could be more, I can help if thats the way you chose  
the first page has a very small custom component (free), the second page is Elements components with a very short Twig snippet

you can refresh my test site, to see it working, no thought in the page design, the two pages do something different to display  
[https://sjwjaw.co.uk/randimage/](https://sjwjaw.co.uk/randimage/)
