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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:49:47+00:00 2026-06-06T06:49:47+00:00

This should be quite easy, and I have done some research on this. I

  • 0

This should be quite easy, and I have done some research on this. I have spliced code from here, here, here, and other places, but I can’t get this to work.

I have a webpage which has 3 .pngs layered on top of each other. The top two are variable sized, and 100% of the page. The top one has a hole in it (it’s transparent in the middle), and the middle disappears using Javascript to reveal the bottom one. The top two .pngs and the Javascript are working perfectly.

I want the bottom image to be in the exact center, vertically and horizontally, and be proportional to the page size. I can get it centered, or proportional, but not both. I can’t put the bottom picture as the background, because then the background isn’t the right color, or it’s tiled.

Here is a sample of some of the code:

HTML:

<body>  
        <div >
    <p0 id="face" ><img src="face2.png"; class='face'> </p0>
</div>
        <p1 id="circuit" > <img src= 'circuit.png' width = '100%' height = '100%' /> </p1>
        <p2 id="hole" ><img src="hole.png" width='100%' height = '100%' /> </p2>
</body>

CSS:

p0{ 
width: 50%;/*I can't set the height to 50% because it is a different size than the width*/
center
z-index:1;
position: absolute; 
}

p1{
z-index: 2;
width: 100%;
padding:0;
margin: 0;
height:100%;
position: absolute; 
}

p2{
z-index:3;
width: 100%;
padding:0;
margin: 0;
height:100%;
position: absolute; 
}
  • 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-06T06:49:48+00:00Added an answer on June 6, 2026 at 6:49 am

    put everything that you want centered into a div that has these:

       .div{
         width: 100%;
         position: relative; // or absolute
         text-align: center;
         text-align: -moz-center;
         text-align: -webkit-center;
         }
    

    here is a linkjsfiddle

    here is full CSS: both images are different sizes in the exact center on top of each other as the question stated,

    .parent{
     width: 100%;
     position:  absolute;
     text-aligh: -align: center;
     text-align: -moz-center;
     text-align: -webkit-center;
    
     }
    
    .center1{
    
    height:120px;
    width: 275px;    
    background-image: url("http://www.google.com/images/srpr/logo3w.png");
    }
    
    .center2{       
    height: 100px;
    width: 200px;
     background-image: url("http://www.google.com/logos/2012/turing-doodle-static.jpg");
    }
    

    ​
    HTML:

         <div class="parent" style="z-index: 1;">
             <div class="center1"></div> 
         </div>
         <div class="parent" style="z-index: 10;">
             <div class="center2"></div> 
         </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems like it should be easy, but I can't quite find an explanation
This should be quite simple, but I can't work out the syntax. I have
I think that this should be pretty easy but I'm not quite sure how
I know this should be fairly easy but I can't quite figure it out
This task should be quite simple, but nothing I tried has worked. I'm just
This should reduce the executable size quite a bit in some of my very
This should be a no brainer but I have a small mystery with the
This should be simple, but I'm getting confused. I have a parent/child tables -
I'm having some trouble figuring something out that should be quite easy and straight
This basic app which was given to me as an project should run quite

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.