Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8284633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:10:34+00:00 2026-06-08T11:10:34+00:00

For a browser-based game I’m working on, I want to allow the user to

  • 0

For a browser-based game I’m working on, I want to allow the user to display their units. A user has the ability to control multiple units, represented by transparent .png images layered using the CSS z-index property. The name of the PNG is stored in a MySQL database. The method of displaying a single unit that I’ve used is using absolute positioning to position all 4 layers of the sprite (skin, clothes, hair, face) and setting the z-index property. The problem is I can’t use this for an indefinite number of units, because otherwise they all end up in the same place.

I need some dynamic method of positioning the units so that I can display 5 per row or something along those lines. Here’s an example of what I’m trying to do that I made (excuse the bad art):

  • Example of layering
  • Stylesheet
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:10:38+00:00Added an answer on June 8, 2026 at 11:10 am

    For a better structure, you should have a div for each of your units. In the div for your unit, you would have the 4 layers.

    The HTML for one unit:

    <div id="character1" class="character">
        <div class="charlayer1"></div>
        <div class="charlayer2"></div>
        <div class="charlayer3"></div>
        <div class="charlayer4"></div>
    </div>
    

    The CSS:

    .character {
        position: absolute;
    }
    
    #character1 {
        left: 60%;
        top: 200px;
    }
    
    .charlayer1, .charlayer2, .charlayer3, .charlayer4 {
        position: absolute;
        top:0;
        left:0;
    }
    
    .charlayer1 {z-index:-4;}
    .charlayer2 {z-index:-3;}
    .charlayer3 {z-index:-2;}
    .charlayer4 {z-index:-1;} 
    

    Now you could add multiple units by using the same html structure, but changing its ID and position.

    Hope it helps! I could elaborate more, but I would need to know what you want to do exactly with your layers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a browser based 3D game using LWJGL with the Java
I'm working on a browser based applet game, and I intend to store the
I want to write a server for a browser-based MMO game, which uses WebSocket
I'm working on a browser based game atm and already looking into options porting
I run a browser based game at www.darknovagames.com. Recently, I've been working on reformatting
I'm making a javascript game but (not browser-based) but the engine I'm using has
so I am making a browser based game using raphael v2 to serve up
Background I have an existing extension designed to accompany a browser-based game (The extension
I'm creating a text-based browser game and need some advice for django model structure.
Is it possible to make a game in the browser based on divs ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.