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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:04:58+00:00 2026-06-18T07:04:58+00:00

I have the following CSS that I use to vertically center a DIV on

  • 0

I have the following CSS that I use to vertically center a DIV on a page (and horizontally center it as well). If the height of the browser window is less than 600px, I would like the window to be able to scroll to show the entire DIV. However, the DIV just centers itself on the page and anything beyond the height of the browser is hidden–no scroll bars. Is there any way to allow the user to scroll to these now hidden regions?

#container{
    width:800px;
    height:600px;
    position:absolute;
    margin-top:-300px;
    top:50%;
    margin-left:-400px;
    left:50%;
}
  • 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-18T07:04:59+00:00Added an answer on June 18, 2026 at 7:04 am

    Add a @media query for max-width and max-height

    @media (max-width: 800px) {
        #container {
            left: 0px;
            margin-left: 0px;
        }
    }
    
    @media (max-height: 600px) {
        #container {
            top: 0px;
            margin-top: 0px;
        }
    }
    

    JSFiddle

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

Sidebar

Related Questions

Hi I have a following css : div.container { height:20px; overflow: hidden; margin: 15px
I have the following CSS that hides the mouse cursor for anything on the
I have the following html/css that is causing problems in Firefox 1.5 and 2,
I have some questions regarding the following css that I found: html, body {
I have the following CSS on my HTML page: <style type=text/css> .hidden {display:none;} .visible
I have bits and pieces of CSS that use the -webkit- vendor prefix. For
Suppose I have the following CSS rule in my page: body { font-family: Calibri,
I have the following code: CSS #main { width:100%; height:120px; border:solid 1px #efefef; }
I have the following snippet that overwrites certain CSS properties:- var styleSheet = document.styleSheets[2];
I have the following CSS that I can apply to an HTML input tag.

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.