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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:31:26+00:00 2026-06-17T07:31:26+00:00

I am creating a login screen where there is a login box that I’d

  • 0

I am creating a login screen where there is a login box that I’d like to appear in the center of the screen (horizontally and vertically) no matter what resolution the user has.

I have looked around and can only find tutorials/articles that center content horizontally, which is half of what I want.

Any idea how I can achieve centralisation in both planes?

  • 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-17T07:31:27+00:00Added an answer on June 17, 2026 at 7:31 am

    The best approach is using CSS and a Javascript callback for older IE versions.

    CSS

    .center {
       width: 300px;          // your login div width
       height: 300px;         // your login box height
       position: absolute;
       left: 50%;
       top: 50%; 
       margin-left: -150px;   // width/2
       margin-top: -150px;    // height/2
    }
    

    HTML

    <div class="center">
        Hey dude, I'm in the middle!
    </div>
    

    Live example

    http://jsfiddle.net/86Asb/

    Negative margins are exactly half the height and width, which pull the element back into perfect center. Only works with elements of a fixed height/width. This will work in all browsers except IE6,IE7 maybe.

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

Sidebar

Related Questions

So I'm creating a site where users must login. If the user wishes that
I am creating a login screen for my application with more than 1 authentication.
What I'm doing is creating a login screen as the first page. Once you
Hy , I am creating an login/logout system with GWT. User is prompted with
HI, i am creating an login screen to my iphone application. i am sending
I'm creating an application in Qt (Nokia SDK) which should hold a login screen,
I am creating an app for android that uses the facebook login. My question
I am creating a login screen and I want to add an header to
I'm trying to start a new user session by creating a helper that POSTs
We are new to ROR, We have issue in creating Login/Logout process in ROR

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.