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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:55:59+00:00 2026-06-13T06:55:59+00:00

Possible Duplicate: Centering one div while another div is floated to the right? I’m

  • 0

Possible Duplicate:
Centering one div while another div is floated to the right?

I’m trying to center container1 and float container2 to its right so that it’s flowing off of the page slightly:

Example: https://i.stack.imgur.com/I7nJx.jpg

Unfortunately, container2 is hopping below and to the right of container1, as you can see in the site mock-up (link right below.)

SITE MOCK-UP:
http://ad313.samrandolphdesign.com/

CSS:

#container1 {
    margin: auto;
    background-color: #FFF;
    width: 80%;
    height: 100%;
    max-width: 600px;
    padding-bottom: 15px;
    display: block;
}

#container2 {
    background-color: #CC9900;
    max-width: 600px;
    width: 80%;
    height: 100%;
    padding-top: 60px;
    padding-bottom: 50px;
    text-align: center;
    float: right;
    display: block;
}
  • 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-13T06:56:03+00:00Added an answer on June 13, 2026 at 6:56 am

    Try using absolute positioning instead of floating.

    Something like:

    #container1 {
        margin: auto;
        background-color: red;
        width: 50%;
        height: 100%;
        max-width: 600px;
        padding-bottom: 15px;
        text-align: center;
        display: block;
        position: absolute;
        left: 25%;
    }
    
    #container2 {
        background-color: #CC9900;
        max-width: 600px;
        width: 50%;
        height: 100%;
        padding-top: 60px;
        padding-bottom: 50px;
        text-align: center;
        display: block;
        position: absolute;
        right: -25%;
    }​
    

    Here is a jsfiddle
    EDIT: If you don’t want absolute positioning for container1, just add top: 0; to container2

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

Sidebar

Related Questions

Possible Duplicate: Vertical centering variable height image while maintaining max-width/height So here is a
Possible Duplicate: What's The Best Way of Centering a Div Vertically with CSS .title_text_only{
Possible Duplicate: How do you easily horizontally center a <div> using CSS? I have
Possible Duplicate: css vertical centering I'm trying to get text centered in a vertical
Possible Duplicate: Opening url in new tab while i am doing window.open(), my page
Possible Duplicate: How do I create a directory and parent directories in one Perl
Possible Duplicate: thread with multiple parameters How does one thread a sub with two
Possible Duplicate: nth-child for every two table rows I'm trying to work my way
Possible Duplicate: How to avoid entering library's source files while debugging in Qt Creator
Possible Duplicate: NAnt or MSBuild, which one to choose and when? What is the

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.