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

  • SEARCH
  • Home
  • 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 6186181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:50:33+00:00 2026-05-24T01:50:33+00:00

For an project I need to as efficiently as possible make a world map

  • 0

For an project I need to as efficiently as possible make a world map out of little square divs of approximately 20x20px.

However because I need the div sizes to scale with the browser I am currently using div’s with a width of 1% and height of 2%, which on a 16:10 screen looks roughly square.

I have a div called “world” filled with lots of little divs like:

<div id="world1" onclick="">&nbsp;</div>

each of these divs is paired with css as follows:

#world1 {
    background: url(/images/1.png) 0 0 no-repeat;
    float: left;
    width: 1%;
    height: 2%;
    position: absolute;
    top: 79%;
    left: 91%;
    z-index: -1;
    margin-top: -10px;
    margin-left: -10px;
}

#world1:hover {
    background-position: 0 -20px;
    cursor: pointer;
}

I figured that the easiest way to make the map is to generate the code for the divs and corresponding css so that divs with names “world1” through to “world20000” are placed at positions ranging from

top:1%;
left: 1%;

to

top:100%;
left: 100%;

and then I would go through by hand and delete divs covering the oceans on my map to create a world map.

How can I generate all this code, or better still is there an easier way to do this, because my solution certainly is not elegant or efficient.

Also does anyone have a more elegant solution for keeping the div’s square in all browser sizes and just scaling the squares with the browser window?

  • 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-05-24T01:50:35+00:00Added an answer on May 24, 2026 at 1:50 am

    A few lines in Perl will do the dirty job for you.

    I figured that the easiest way to make the map is to generate the code
    for the divs and corresponding css so that divs with names “world1”
    through to “world20000” are placed at positions ranging from…

    It would be easier if you do not place it in absolute positions, but used float:left, added as many squares you want to fill an entire row, and later use clear:left to jump to another row. Not more than 20 line in Perl.

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

Sidebar

Related Questions

In my project I need to write small WYSIWYG editor (just let users make
I am doing a project at the moment and I need an efficient method
my project need to read multiple web pages at a time(eg: for a particular
My project need to compare output(only urls) of google and yahoo for a particular
The Junits I have in my project need to load property files from the
For a project I need to read and write ESRI shapefiles. It should be
to my project i need document editor for many types of documents(tabular data, invoices,
In my project I need to create a business object validation layer that will
In a current project I need to support finding a User by login credentials
For a school project I need to create a program and it'd be nice

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.