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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:07:35+00:00 2026-05-15T02:07:35+00:00

Okay I wrapped the divs within a div. Why does this not work? <!DOCTYPE

  • 0

Okay I wrapped the divs within a div. Why does this not work?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <title>test.html</title>
    <style type="text/css">
        .wrapper
        {
            margin: 0px auto;
        }
        .testimonials_png
        {
            position: absolute;
            left:20px;
            top:397px;
            width:220px; 
            height:395px;
            background: url("test_files/testimonials.png") no-repeat;
        }
        .homeLink_png
        {
            position: absolute;
            left:-1px;
            top:243px;
            width:203px; 
            height:75px;
            background: url("test_files/homeLink.png") no-repeat;
        }
        .sidingLink_png
        {
            position: absolute;
            left:202px;
            top:243px;
            width:180px; 
            height:75px;
            background: url("test_files/sidingLink.png") no-repeat;
        }
        .windowsLink_png
        {
            position: absolute;
            left:382px;
            top:243px;
            width:181px; 
            height:75px;
            background: url("test_files/windowsLink.png") no-repeat;
        }
        .roofingLink_png
        {
            position: absolute;
            left:563px;
            top:243px;
            width:183px; 
            height:75px;
            background: url("test_files/roofingLink.png") no-repeat;
        }
        .aboutLink_png
        {
            position: absolute;
            left:746px;
            top:243px;
            width:205px; 
            height:75px;
            background: url("test_files/aboutLink.png") no-repeat;
        }
        .banner_png
        {
            position: absolute;
            left:0px;
            top:0px;
            width:950px; 
            height:243px;
            background: url("test_files/banner.png") no-repeat;
        }

    </style>
     </head>
  <body>
    <div class="wrapper">
    <div class="testimonials_png"> </div>
    <div class="homeLink_png"> </div>
    <div class="sidingLink_png"> </div>
    <div class="windowsLink_png"> </div>
    <div class="roofingLink_png"> </div>
    <div class="aboutLink_png"> </div>
    <div class="banner_png"> </div>
    </div>
  </body>
</html>
  • 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-15T02:07:36+00:00Added an answer on May 15, 2026 at 2:07 am

    For the browser be able to correcty center a div, you must give it some info about that div, so:

        .wrapper
        {
            margin: auto;
        }
    

    (copied from your code) it’s wrong, but:

        .wrapper
        {
            width:900px;
            margin:0 auto;
        }
    

    Works just fine! your telling the browser that your wrapper as 900px of width and the rest the browser should split equally by the wrapper left and right side… Thus margin:auto; will provide you with nothing… needs the unit spec (for centering, use 0).

    Another problem in your code is the fact that you have the content of wrapper with position absolute, and that will be rendered by the browser as elements outside your wrapper.. so, it’s just like if your wrapper isn’t there, so:

        .wrapper
        {
            postion:absolute;
            top:0;
            left:50%;
            width:900px;
            margin-left:-450px;
        }
    

    This will the the browser that the wrapper is to by in an absolute position, that it is 0units from the top, and 50% of the browser’s window from the left… to center it, just pull it back half of the given width, thus -450px of margin-left.

    Now, your content should be set to position:relative; to be relatively positioned regarding the wrapper’s position…

    OK, here is your code (tested):

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
        <title>test.html</title>
        <style type="text/css">
            .wrapper
            {
                position:absolute;
                left:50%;
                width:950px;
                margin-left:-475px;
            }
            .testimonials_png
            {
                position: absolute;
                left:20px;
                top:397px;
                width:220px;
                height:395px;
                background:green url("test_files/testimonials.png") no-repeat;
            }
            .homeLink_png
            {
                position: absolute;
                left:-1px;
                top:243px;
                width:203px;
                height:75px;
                background:purple url("test_files/homeLink.png") no-repeat;
            }
            .sidingLink_png
            {
                position: absolute;
                left:202px;
                top:243px;
                width:180px;
                height:75px;
                background:orange url("test_files/sidingLink.png") no-repeat;
            }
            .windowsLink_png
            {
                position: absolute;
                left:382px;
                top:243px;
                width:181px;
                height:75px;
                background:yellow url("test_files/windowsLink.png") no-repeat;
            }
            .roofingLink_png
            {
                position: absolute;
                left:563px;
                top:243px;
                width:183px;
                height:75px;
                background:blue url("test_files/roofingLink.png") no-repeat;
            }
            .aboutLink_png
            {
                position: absolute;
                left:746px;
                top:243px;
                width:205px;
                height:75px;
                background:red url("test_files/aboutLink.png") no-repeat;
            }
            .banner_png
            {
                position: absolute;
                left:0px;
                top:0px;
                width:950px;
                height:243px;
                background:pink url("test_files/banner.png") no-repeat;
            }
    
        </style>
         </head>
      <body>
        <div class="wrapper">
            <div class="testimonials_png"> </div>
            <div class="homeLink_png"> </div>
            <div class="sidingLink_png"> </div>
            <div class="windowsLink_png"> </div>
            <div class="roofingLink_png"> </div>
            <div class="aboutLink_png"> </div>
            <div class="banner_png"> </div>
        </div>
      </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.