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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:41:37+00:00 2026-05-12T16:41:37+00:00

I commonly use hidden divs on my pages until they need to be unhidden

  • 0

I commonly use hidden divs on my pages until they need to be unhidden with javascript. I used to do the initial hiding with javascript too, but now moved away to hiding them with css to guarantee that the hiding takes place (js disabled in the browser). Also there was a latency issue with js hiding (waiting for the js to load).

My problem is that with css, there’s still some latency, and so I end up including the style with the markup like below, and I kind of hate doing it, makes me feel like I’m doing something wrong..

<div style="display:none;">
   content
</div>

How often do you guys do this? and is there a way I can get the css or js to somehow load BEFORE the rest of the markup?

Thanks in advance

  • 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-05-12T16:41:37+00:00Added an answer on May 12, 2026 at 4:41 pm

    Include the css in an inline style block at the top of the page:

    <style>
      .hidden:  { display: none; }
    </style>
    

    Then annotate your div with the needed class:

    <div class="hidden"> ... </div>
    

    The upshot of this approach is that to show the element, you don’t need to set display to block, you can just add/remove the class from the element with JavaScript. This works out better because not every element needs display=block (tables and inline elements have different display modes).

    Despite what another poster said, it’s not bad practice. You should separate your CSS into presentational and functional markup – functional one controls such logical things as whether or not something gets shown, presentational one just determines how to show it. There is no issue putting functional CSS inline to avoid the page jumping around.

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

Sidebar

Related Questions

Three.js is commonly used with WebGL, but I am interested in using its CanvasRenderer,
What are few commonly used Hidden Lists and Objects that we should know of
I need to know what folder names are commonly used by Version Control systems.
Which one of these two is most commonly used scenario? I want to use
Is the model-view-controller-pattern commonly used in Java? I heard, that it's common to use
I commonly use the DEBUG preprocessor flag. But I've recently figured out that Ad-hoc
When writing programs (C#.NET) I'll commonly use external libraries I've downloaded from various websites
A data structure that I use commonly in multi-threaded applications is a ConcurrentHashMap where
I have seen two commonly used techniques for adding the directory of the file
What is the most commonly used (simplest) C / C++ compiler used on Windows

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.