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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:28:07+00:00 2026-06-07T18:28:07+00:00

I have being researching regarding this question for a long time but I was

  • 0

I have being researching regarding this question for a long time but I was not lucky. Here is the situation. Assume you have a blue rectangle in the center of the page. When you go full screen, we can use percentage for height and width to preserve the ratio of rectangle. However, the position of rectangle changes and it moves up and you end up with extra space at the bottom of the page.

So what should I do to keep rectangle in the center of the page (equal vertical and horizontal distance) when full screen mode is enabled? In other words, if your screen is 1280×800, center of rectangle be at (640,400)

If you check home page of Chrome browser, when you go full screen, the position of apps stay the same and you don’t end up with extra space at the bottom. Appreciate your help

  • 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-07T18:28:09+00:00Added an answer on June 7, 2026 at 6:28 pm

    Define width of the rectangle and use margin: 0 auto; to center it in page horizontally.

    If you want to center a div horizontally and vertically, use something like this

    HTML

    <div id="rectangle"></div>
    

    CSS

    #rectangle {
       width: 30%; //can set any value here
       height: 20%; //can set any value here
       position: absolute;
       left: 50%;
       top: 50%; 
       margin-left: -15%; //negative half of width
       margin-top: -10%; //negative half of height
       background-color: red;
    }​
    

    See the fiddle here.

    OR

    HTML

    <div id="wrapper">
      <div id="container">
        <div id="rectangle"></div>
      </div>
    </div>​
    

    CSS

    body, html {
        height: 100%;
        overflow:hidden;
    }
    #wrapper {
        width: 100%; 
        height: 100%; 
        overflow: visible; 
        position: relative;
    }
    #wrapper[id] {
        display: table; 
        position: static;
    }
    #container[id] {
        display: table-cell; 
        vertical-align: middle; 
        width: 100%;
    }
    #rectangle {
        width: 200px; 
        height: 100px; 
        margin-left: auto; 
        margin-right: auto; 
        background-color: blue;
    }
    

    ​
    See the fiddle here.

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

Sidebar

Related Questions

I have taken a long time researching how to perform this operation between arrays
I have a page being ajaxed in, but the document ready code will not
Okay I am newer to python and have been researching this problem but I
I have a datalist being generated with ASP, but unfortunately the jQuery script that
I have posted this to ServerFault, but the Node.js community seems tiny there, so
so I have been researching this all morning- and I'm pretty sure the code
I know this has been asked before (and I will keep researching), but I
I've been researching this, but i wanted some input from the community in regards
I have been researching and trying to learn the proper method to accomplish this.
The title of the question says it all. I have been researching SHA-1 and

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.