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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:31:48+00:00 2026-05-27T15:31:48+00:00

In all the posts I’ve been able to find a deal with either centering

  • 0

In all the posts I’ve been able to find a deal with either centering a div inside another div or putting a div at the bottom of another div, and the advice has been great but I haven’t been able to find anything to do both.

My code is:

<body style="text-align:center; margin:0; padding:0;">
  <div style="width:100%; height:100px; background-image:url(header.png);position:relative;">
    <div>
      <div style="height:75px; width:950px; background-image:url(formtop.png); bottom:0; position: absolute; margin-left:auto; margin-right:auto;">
        <div style="float:left; position:relative; left:30px; top:15px">
          <img src="logo.png" width="88" height="38">
        </div>
        <div style="margin-top:15px">
          <h1>Product Form</h1>
       </div>
     </div>
   </div>
 </div>
</body>

All I want to do is to put the formtop.png div at the bottom and center of the containing div. I can do one or the other but I can’t do both. If I change position:absolute to position:relative then the image centers itself but its too high. When I change it back to absolute then it sits nicely at the bottom of its containing div but in IE it’s way off the right and in firefox it’s at the left side of the page.

Any advice?

  • 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-27T15:31:49+00:00Added an answer on May 27, 2026 at 3:31 pm

    You can do it by setting the formtop.png <div> to 100% width and centering the background image using CSS:

    <!-- div with the formtop.png background -->
    <div style="
       height:75px; 
       width:100%; 
       background:url(formtop.png) no-repeat 50% 0; 
       bottom:0; 
       position: absolute;">
    

    As an aside, if you move all your inline styles into a .css file, your code will be a lot easier to work with and maintain:

    <div class="formTop">
    
    .formTop {    
        position: absolute;
        bottom: 0;
        left: 0;    
    
        height: 75px;
        width: 100%;
    
        /* Set the background image to centered in this element */
        background: url(formtop.png) no-repeat 50% 0;      
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have checked all posts here, but can't find a solution for me so
I want to find all records, say Posts, created today with Ruby on Rails,
I have seen posts all over the internet that talk about how to fix
I´m a little bit confused by reading all the posts and tutorials about starting
I have this code which gets WP posts, but it gets all the posts
On my blog, I want to display the all the posts from the last
I've looked around at pretty much all the SMS posts here on SO and
When I change my permalinks to custom: /%postname%.html My posts are all redrawn correctly
Okay guys, I have read through all the other posts and question on jQuery
Problem Given the following two tables, I'd like to select all Ids for Posts

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.