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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:32:16+00:00 2026-06-12T19:32:16+00:00

I have found numerous partial answers to this question, but nothing that seems like

  • 0

I have found numerous partial answers to this question, but nothing that seems like a definitive answer. For such an important technique I find this a little strange.

How should I hide elements (using javascript) so that they do not appear briefly when the page loads before the JS has a chance to hide them? I don’t want to set them to hidden initially with CSS as if a user doesn’t have Javascript, they will see nothing.

To be clear. I’m not asking how to handle displaying content to users who don’t have JS. That is an entirely different subject. I just want a reliable way to hide HTML elements before they are displayed.

So my requirements:

  1. HTML elements are not hidden initially using CSS
  2. If JS is available, these elements are hidden so that they are never displayed, not even for an instant. This means hiding them from JS loaded at the end of the body is out).
  • 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-12T19:32:18+00:00Added an answer on June 12, 2026 at 7:32 pm

    Like VKen, I prefer to use moderizr and Paul Irish’s structure for the html element (which is what HTML5 Boilerplate uses)

    <!DOCTYPE html>
    <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
    <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
    <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
    <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
    

    Then in the style sheet:

    .element-to-hide { display: none; }
    
    .no-js .element-to-hide { display: block; }
    

    Works great, no flash of elements disappearing.

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

Sidebar

Related Questions

I have searched the numerous questions that look like this one, but haven't found
I have found already some similar discussion on this, but would like to investigate
I have found numerous sources for monitoring battery levels, but none of them describe
I have found that I have no problem using require to load something like
I have found many great answers to this from a year ago (when it
I have found numerous jQuery plugins that allow you to flip an element; SmashUp
I have found numerous answers on how to extract the URL without the parameters.
I really hate to ask this question, because it seems like it's been asked
i've found numerous things online for this but they dont work for me. am
I have found numerous examples on uploading a file to a web server via

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.