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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:14:50+00:00 2026-05-28T18:14:50+00:00

I work on a 100% Javascript site that uses a CSS class on the

  • 0

I work on a 100% Javascript site that uses a CSS class on the body to explicitly hide everything (display:none), then enables blocks as needed (unusual yes, but I can’t change the architecture).

I’d like to display a noscript message to users without js enabled, but we run into a CSS puzzle. noscript must exist within the body. Unlike other blocks on the page, the noscript element can’t be forced to become visible, as far as I can tell. The weird thing is that when I select the noscript element with Webkit Inspector, it “claims” that the noscript element is visible. But no matter what, nothing appears on screen with js disabled.

I’ve done two test cases – one with standard noscript, and another with a hidden div. Either way, the hidden element remains hidden no matter what. My theory is that it’s simply not possible to selectively display an element that’s nested inside a hidden parent element (i.e. noscript within body).

Here’s my simple test case.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <style type="text/css" media="screen">
        body{
            display:none;
        }

        body noscript  {
          display:block;
          visibility:visible;
          color:black;
        }  
    </style>
</head>

<body>
    <p>Normal text</p>

    <noscript>
        <p>This is is noscript</p>
    </noscript>
</body>
</html>

[Later: Example simplified for clarity]

Is this solvable? Thanks.

  • 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-28T18:14:52+00:00Added an answer on May 28, 2026 at 6:14 pm

    Rather than making the body hidden:

    body { display: none; }
    

    Can you make everything in the body hidden?

    body * { display: none; }
    

    Then override that for the noscript – or a div within the noscript, e.g.

    body noscript #requirements { display: block; }
    

    Edit

    Revisiting this after shacker’s comment and looking at my test page with Firebug, it became obvious what the problem was.

    body * { display: none; } applies to everything within the body at any depth, so even if I correctly make the <noscript> display correctly, the contents inside it still don’t display.

    The solution is to target more specifically, using a child selector instead of a descendant selector.

    Given this html, I see nothing when javascript is enabled, but I see the contents of the <noscript> block, which lists my site requirements, when javascript is disabled.

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8">
            <style type="text/css" media="screen">
                body > * {
                    display: none;
                }
                body > noscript {
                    display: block;
                }
            </style>
        </head>
    
        <body>
    
            <p>A normal text block, within a &lt;p&gt;</p>
    
            <div>A standard &lt;div&gt; with only this text in it</div>
    
            <noscript>
                <div id="requirements">
                    <p>
                    This is my noscript div, that is, a &lt;div&gt;
                    within the &lt;noscript&gt; tag.
                    </p>
                    <p>
                    This site requires that javascript and cookies are enabled.
                    </p>
                </div>
            </noscript>
    
        </body>
    </html>
    

    The rule for body > * hides all immediate children of the body, and therefore their descendants too, while the body > noscript rule reveals the content of the noscript block, and of course that block only displays if javascript is disabled.

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

Sidebar

Related Questions

I work 100% with a branch that I made off of the master branch.
height: 100% in CSS obviously doesn't work. So is there any other CSS or
I've got a piece of JavaScript that inserts/removes an iframe from the DOM. Everything
Let's say you work 100 days on a project. How many days would each
The IT department where I work is trying to move to 100% virtualized servers,
in django 1.1.1, Place.objects.in_bulk() does not work and Place.objects.in_bulk(range(1, 100)) works and returns a
work on asp.net vs 05 C#.Master page header contain the bellow code <script type=text/javascript
I am using a div with class scroll-pane (height 100%) within an absolute positioned
I'm trying to write a JavaScript tool to work on items of a certain
Why php functions or classes cannot work like jquery/ javascript plugins? For instance, a

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.