If the browser doesn't support CSS, then it's going to ignore the order not to display, and it's going to show up.

If you're going to go to the trouble of doing server-side browser detection (which I _really_ _really_ don't recommend, it's better to degrade gracefully than to intentionally give them lower quality because of some string that they send you), then you could just not send the block, rather than embedding it in a comment.

And as odd as this sounds -- if a browser correctly parses SGML comments, then <!-- <!-- blah --> --> will not show anything through to the user. (as when there's a '--' within a comment declaration, it's not supposed to end when it sees the close. It's only supposed to close if there's a even number of '--' pairs. (unfortunately, most people don't know this rule, and do things like use 'i--' in javascript), so browsers tend to incorrectly parse SGML comments intentionally.)


In reply to Re^2: (OT) How to hide DIV contents from incompatible browsers? by jhourcle
in thread (OT) How to hide DIV contents from incompatible browsers? by TedPride

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.