How to create dynamic background for HTML5 build?

So that when you change the size, the game remains centered and the background changes (including the background color).
In the game on the screenshot this works well.

Oh, that’s an ancient technology of the earliest times.

Just a background is html5 part.
Css:

body {
		background-color: #1e2226;
		background-repeat: no-repeat;
		background-attachment: fixed;
		background-position: center;
		background-image: url(bg1.jpg);
		background-size: cover;
		height: 100%;
    	width: 100%;
	}

and bg1.jpg in the bundle folder

12 Likes

Thanks! Please tell me more about your project:

  1. Display size (width and height)
  2. HTML5 Scale Mode
  3. The size of your background image

I have problems with my background image

Hi!
The last question is still relevant, I will be glad if you answer, thanks!

Hey, I’m not sure if these settings are workable with the new html5 template, the last time I updated the web version of the project was about two years ago.

project settings:
[display]
width = 720
height = 1280
high_dpi = 1

[html5]
scale_mode = fit

The size of your background image:
1920*1080

2 Likes