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

  • Home
  • SEARCH
  • 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 8592973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:52:48+00:00 2026-06-11T23:52:48+00:00

Right now I have a website which has an overall height set at 750px.

  • 0

Right now I have a website which has an overall height set at 750px. I have it vertically centered using the position absolute and negative margin method. It works great apart from one problem.

If I try use it on a lower-res monitor or mobile device it cuts the top of the page.

Here is my code

HTML

<body>
<div class="content">
CONTENT IS HERE
</div>
</body>

CSS

.content {
position:absolute;
top:50%;
height:750px;
margin-top:-375px; /* Half of 750px */
}

I tried using overflow:scroll; on the body tag but I understand that it doesn’t work, I didn’t expect it to. I am totally stumped! Is there any suggestion?

  • 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-11T23:52:50+00:00Added an answer on June 11, 2026 at 11:52 pm

    You can overwrite it with a mediaquery on small screens:

    .content {
        position:absolute;
        top:50%;
        height:750px;
        margin-top:-375px;
    }
    @media only screen and (max-height: 750px){
        .content {
            top:0;
            margin-top:0;
        }
    }
    

    Actually, this is a graceful degradation method, but if you’re designing for mobile you probably want to approach in a progressive enhancement way. In that case, it becomes:

    .content {
        height:750px;
    }
    @media only screen and (min-height: 751px){
        .content {
            position:absolute;
            top:50%;
            margin-top:-375px;
        }
    }
    

    Speaking about compatibility, the only keyword after @media prevent older browsers from rendering the rules contained.

    To reach (almost) full compatibility, you can use this very useful plugin: respond.js

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

Sidebar

Related Questions

I have a website and right now users can just open a directory and
I have a website that right now, runs by creating static html pages from
Basically, we have an ASP website right now that I'm converting to PHP. We're
I'm designing a website right now, and have a menubar at the top for
I am working on a website which already has user access set up so
i have made a company website which has the MYSQL database of accounting,inventory,expenses, etc.
I have a website already running made with CakePHP, which has its own login
I have a custom made website and right now each time I want to
Right now I have a voting system on my website that stores all votes
Here is the thing. Right now I have this e-commerce web site where people

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.