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 9239231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:56:23+00:00 2026-06-18T07:56:23+00:00

I made a image map using div with a bunch of <a> inside of

  • 0

I made a “image map” using div with a bunch of <a> inside of a div. It works fine but now I want to be able to scale it so that it can resize the div but my <a> will stay in the same position relative to the div.

<div class="container">
    <a href="#a1" class="dot" style="top: 138px; left: 28px"></a>
    <a href="#a18" class="dot" style="top: 45px; left: 261px"></a>
    <a href="#a20" class="dot" style="top: 45px; left: 336px"></a>

and the css

#kit .container {
position: relative;
margin: auto;
background-image: url(../img/9829-Kit.png);
background-repeat: no-repeat;
height: 670px;
width: 700px;
}
a.dot {
position: absolute;
display: block;
height: 33px;
width: 34px;
cursor: pointer;
background-position: 0px 0px;
background-image: url(../img/dots.png);
background-repeat: no-repeat;
}
a.dot:hover {
background-position: 0px -40px;
cursor: pointer;
}
  • 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-18T07:56:24+00:00Added an answer on June 18, 2026 at 7:56 am

    Because you’re using pixels for your offsets, your divs will never move relative to the left and top edges of their parent. You’ll need to convert pixels to percentages, and then the child elements’ size and position will grow and move when the parent resizes.

    However, since you’re using sprites for the hover pseudo-class, the design will break if you resize your parent div, and the child divs also resize. If you don’t need the child divs to resize, leave their size as a pixel value, and just set the top/left as percentages.

    Example, the #a1 div is set to be 138px from the top, and 28px from the left.

    28px / 700px (width of parent) * 100 = 0.4%

    138px / 670px (height of parent) * 100 = 20.597015%

    So the #a1 div should have be set to have left:0.4% and top:20.597015%.

    I believe this will work as long as you’re not using margins, but actual absolute positioning. If not, you’ll have to use javascript to convert the percentage to a pixel value (based on parent size) each time the parent div is resized.

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

Sidebar

Related Questions

So I made an image flipbook animation that reacts to mousedrag. It works fine
I have a simple CSS image map that works like this: HTML: <div style=display:block;
I made an image slider using this plugin http://slidesjs.com/ while ago for a mobile
Can someone help me on this. I'm made an image uploader and i want
I made a header image, but for some reason I can't get it to
I've made a custom image for a checkbox and want it to switch between
So I made a background image to that is just two colored bars to
I have two PDFs that are made on the fly using Prawn PDF. The
I'm using KImageMapEditor on Linux (Ubuntu) to create an image map. The shapes in
I'm trying to make a legend for a colormapped image that's been made from

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.