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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:10:06+00:00 2026-06-04T06:10:06+00:00

What I want is to show Loading… as a simple text while page is

  • 0

What I want is to show “Loading…” as a simple text while page is loading and I want the text to be centered both – horizontally and vertically. I go through a lot of examples and now I have some sort of solution which seems to work, but I have some doubts that the effect will be the same all the time and that my code is even close to a good CSS.
What I have is a index.php page where right after the <body> tag I have this:

<body>

        <div id="loading-standard-user">
            <p id="loading-standard-user-text">Loading...</p>
        </div>

Later on I have a function that take care for hiding the text when page is loaded, but what concern’s me is the styling of the <div> and <p> tags.
Here is my CSS:

#loading-standard-user {
  width: 100%;
}

#loading-standard-user-text {
  position: fixed;
  width: 100%;
  text-align: center;
  font-size: 40px;
  font-family: arial;
  top: 50%;
  margin-top: -40px;
}

I’m pretty sure that I have some unnecessary code and at the same time I miss something, one thing that I wonder is that my font-size: 40px which would have to mean that if I want my code to be vertically centered later on my margin-top should have value equal to half the size of my font, but visually it looks centered when margin-top is with the size of the font.
Anyways any thoughts on the styling and where are my mistakes and how could I do it right?

Thanks

Leron

  • 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-04T06:10:08+00:00Added an answer on June 4, 2026 at 6:10 am

    Your CSS code seems to do almost exactly what you want. The only problem with it that I can find is that your margin-top should be -50% of the height. Your div height is 40px (which is the font size), so your margin-top should be -20px to center it exactly.

    In more detail: top: 50% sets the top of the text halfway the container. Then margin-top: -20px moves it up 20px to center it.

    Edit:
    If you want to use em, like suggested by @mgibsonbr, try the following CSS:

    #loading-standard-user {
      position: fixed;
      width: 100%;
      height:40px;
      top: 50%;
      margin-top: -2em;
    
    }
    
    #loading-standard-user-text {
      width: 100%;
      text-align: center;
      font-size: 4em;
      font-family: arial; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to show a div with a loading animation over my page while
I want to show preload image while main page is preparing and then loading.
I want to show page loading spinner in my html page content using jquery
My problem is pretty common. I want to show some loading stuff while the
I want to show a splash screen while my application's main form is loading
I want to show an loading GIF while my PHP-script is working, small ex:
I have images on my page. I want to show a loading bar on
I want to show a loading image before the content of the whole page
I want to show loading animation on my splash screen while loading application. Is
I want to use show a Loading Image on the click of server side

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.