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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:14:51+00:00 2026-06-07T14:14:51+00:00

<!DOCTYPE html> <html><head><style> html, body{ width: 99%; /* to prevent scroll bar when unnessery

  • 0
<!DOCTYPE html>
<html><head><style>
html, body{
    width: 99%; /* to prevent scroll bar when unnessery */
    height: 100%;
}
div#main_container{
    position: absolute; 
    top: 50%; margin-top: -200px;
    left: 50%;  margin-left: -400px;
    width: 800px; height: 400px;    
    border: 1px solid black;
}
</style></head><body>
<div id='main_container'>
     Some content
</div>
</body></html>

PROBLEM: If I make window of the browser smaller then my content block, I can’t seen the top and left parts of the block – scrolling bars looks like I am on max of top\left of content, but no top and right of my block is seen.

Why does it happens and how to fix it?

I tested in 3 browsers, so it’s not browser issue.

  • 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-07T14:14:53+00:00Added an answer on June 7, 2026 at 2:14 pm

    It happens because it’s meant to happen. Let’s to the math for a browser with it’s height at 200px.

    So, what’s 50% of 200px? datarara.. it’s 100px. That puts the top of #main_container at 100px in the y-axis. Give it a margin of -200px, and it goes up 200px. If it’s at 100px and it moves up 200px, #main_container‘s top gets placed at -100px. No wonder why part of it is hidden.

    The Solution

    A solution would be to make the position: absolute on #main_container relative to the body element and not the browser window (that is: set position:relative on body). Then, by setting a min-height and min-width on body equal to #main_container‘s height and width (respectively), no matter how short the window would become, the body’s dimensions would never be smaller than #main_container – no possible “overflow”.

    Applying those styles to the body element, however, assumes you’ll only have on of those absolutely positioned boxes on your page. If this is not the case, then wrapping #main_container with it’s own div would probably be the most compatible solution. Here’s that solution:

    The HTML

    <div class="wrap">
        <div class="box"></div>
    </div>
    

    The CSS

    .wrap {
        position: absolute;
        top: 0; left: 0;
        width: 100%; height: 100%;
        min-width: 800px; min-height: 400px;
    }
    
    .box{
        position: absolute;
        top: 50%; margin-top: -200px;
        left: 50%;  margin-left: -400px;
        width: 800px; height: 400px;    
        border: 1px solid black;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this HTML: <!DOCTYPE html> <html> <head> <title></title> <style type=text/css> div { position: relative;
HTML <!doctype html> <html> <head> </head> <body> <button id=b1 type=button>Show Spoiler</button> <p id=p1 style=display:none>
<!DOCTYPE html> <html> <head> <title>Title</title> <meta http-equiv=content-type content=text/html; charset=utf-8> <style type=text/css> body { background:
I have the following page: <!DOCTYPE html> <html> <head> <style type=text/css> html, body {
<!DOCTYPE html> <html> <head> <title>MyTitle</title> <style type=text/css> body { background-image:url('images/my.png'); /*width:100%;*/ height:100%; background-repeat:no-repeat; background-size:100%;
Here's teh codez: <!DOCTYPE html> <html> <head> <title>Test</title> <style type=text/css> html, body { margin:
given the following code <!DOCTYPE html> <html> <head> <title>show stats</title> <style> span.main { position:relative;
Imagine three images with fixed size: <!DOCTYPE html> <html> <head> <style type=text/css> div.photos img
I have sample site: /index.html /appcache.manifest /style.css /test.js index.html: <!DOCTYPE HTML> <html manifest=appcache.manifest> <head>
<!doctype html> <html lang=en> <head> <meta charset=utf-8/> <style> form:focus{ background:red; } </style> <title>Home, sweet

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.