Change webpage background color of whole page when there is scrolling

Hi everyone. Hoping this is a simple fix. I want to set the background color of my web app’s page, and I know I can do this easily with the following in Opening:

me.Style.BackgroundColor = &cedd8c2

However, when there is more on the page where the user needs to scroll down to see the rest, the background color only seems to go as far as the original height of the browser page, and once you scroll down, it is white. See below. Any ideas? I tried a timer.calllater, but this did not seem to do the trick

Not a great one… but it’ll work…

ExecuteJavaScript("document.body.style.backgroundColor = '#FF00FF'")

You might want to file a ticket for the ability to set the browser page background color. It looks like Xojo is limiting the background color to the <div> that it uses for the virtual “page”.

Update: I’ve filed a ticket for the ability to access document body styles through the Session object, because that seems quite useful.

#72913 - Feature Request: WebSession.Style could provide access to the document.body.style

3 Likes

That works perfectly! Thanks Tim, and thanks for also filing a request

Thank you for testing this, I didn’t and I was not expecting something like that.

If you will change the background color once, you can use the App HTML Header too:

<style>
body { background-color: rgb(237, 216, 194) }
</style>
1 Like