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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:16:24+00:00 2026-05-18T07:16:24+00:00

I have a container div which is centred at 50% of the page width.

  • 0

I have a container div which is centred at 50% of the page width. This has 10px padding and position relative. I then have a div inside this which is set to width 80%, float left and is a different colour, and also has padding of 10px. There is another div set to float right which has width 20%. Neither of the nested divs have a border or margin. However the right one appears below the other one only up to a particular screen size.

My html / css is as follows:

<html>
    <head>
        CSS file included here
    </head>
    <body>
        <div class="page-container">
            <div class="right-col"></div>
            <div class="left-col"></div>
            <div class="clear"></div>
        </div>
    </body>
</html>


.page-container {
    width: 50%;
    margin-left: auto;
    margin-right: auto;
}

.left-col {
    width: 80%;
    float: left;
}

.right-col {
    width: 20%;
    float: right;
}

.clear {
    clear: both;
}

This has been bugging me for ages so I would appreciate any help anyone can give me. Thanks in advance.

Regards,

Richard

  • 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-18T07:16:25+00:00Added an answer on May 18, 2026 at 7:16 am

    Your example doesn’t contain any padding and looks the same at any screen size. If you add padding to the left div it gets added to the total width so it gets a width of 80% + 20px. If your content in the left div needs some padding add another div inside it with a 10px margin.

       <div class="page-container">
            <div class="right-col"></div>
            <div class="left-col">
                <div class="left-col-inner"></div>
            </div>
            <div class="clear"></div>
        </div>
    

    css

    .left-col-inner{
    margin:10px;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a container div which is position:relative and the squares are position:absolute because
Lets say I have a container div, inside of which are div containers of
I have a DIV container which has some text, background-image, image. I need to
I have a div container which has a repeating background image that forms a
I'd like to have on my page a div which is centered and has
I have a container div , inside which I want to pack a variable
I have a div which is centred on the page that contains text loaded
I have a container DIV which contains several block-DIVS. Every block-DIV contains SPAN items
I'm with a little problem. I have the container div for some elements which
I have div class=contentBlock which is treated as the container for updating <div class=contentBlock></div>

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.