• Display only if CSS is enabled

    From Stefan Ram@21:1/5 to All on Wed Dec 4 14:31:24 2019
    Is there a standard solution to realize the following?

    A page element (like a div or p element) is not displayed
    in browsers that do not support CSS or when the access to
    CSS resources is denied.

    But when the browser supports CSS and the CSS resource is
    accessible, then the CSS resource contains rules which then
    will make this element visible.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Martin Leese@21:1/5 to Stefan Ram on Wed Dec 4 11:10:32 2019
    Stefan Ram wrote:
    Is there a standard solution to realize the following?

    A page element (like a div or p element) is not displayed
    in browsers that do not support CSS or when the access to
    CSS resources is denied.

    But when the browser supports CSS and the CSS resource is
    accessible, then the CSS resource contains rules which then
    will make this element visible.

    Sounds like you want the new "hidden"
    attribute. Visit: https://html.spec.whatwg.org/multipage/interaction.html#the-hidden-attribute

    Never used it myself, so I cannot help you
    further.

    --
    Regards,
    Martin Leese
    E-mail: please@see.Web.for.e-mail.INVALID
    Web: http://members.tripod.com/martin_leese/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Ram@21:1/5 to Martin Leese on Wed Dec 4 20:21:47 2019
    Martin Leese <please@see.Web.for.e-mail.INVALID> writes:
    Sounds like you want the new "hidden"
    attribute. Visit: >https://html.spec.whatwg.org/multipage/interaction.html#the-hidden-attribute

    That's a good answer, but I would prefer something that even
    works in older browsers.

    Maybe something like (written as a rough draft):

    <!DOCTYPE HTML><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head><meta charset="UTF-8" /><title>main</title><style type="text/css"> script[type="text/plain"]{ display: block }
    </style></head><body>
    <pre><code><script type="text/plain">
    howdy!
    </script></code></pre></body></html>

    . It even seems to work in a first test, but is this legal?
    (Does it meet all requirements of relevant standards?)

    Can one be sure that popular browsers will not try to
    execute "howdy!" as JavaScript?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?B?8J+YiSBHb29kIEd1eSDwn5iJ?@21:1/5 to Stefan Ram on Thu Dec 5 00:33:25 2019
    This is a multi-part message in MIME format.
    On 04/12/2019 14:31, Stefan Ram wrote:
    Is there a standard solution to realize the following?

    No there isn't anything like what you want to do because anything on an
    HTML page is visible by default. You can then use css to hide them but
    there isn't anything that can hide the text by default and only visible
    when css is enabled. Never seen anything like that.

    The css rules are:

    display: none;
    visibility: hidden;

    This is for css so if the style sheet or styles are disabled then you
    can't use them.




    A page element (like a div or p element) is not displayed
    in browsers that do not support CSS or when the access to
    CSS resources is denied.

    But when the browser supports CSS and the CSS resource is
    accessible, then the CSS resource contains rules which then
    will make this element visible.




    --
    With over 1,000,000 million devices now running Windows 10, customer satisfaction is higher than any previous version of windows.

    <html>
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    </head>
    <body bgcolor="#FFFFE0" text="#006600">
    <div class="moz-cite-prefix">On 04/12/2019 14:31, Stefan Ram wrote:<br>
    </div>
    <blockquote cite="mid:CSS-20191204152601@ram.dialup.fu-berlin.de"
    type="cite">
    <pre wrap=""> Is there a standard solution to realize the following?</pre>
    </blockquote>
    <br>
    No there isn't anything like what you want to do because anything on
    an HTML page is visible by default.   You can then use css to hide
    them but there isn't anything that can hide the text by default and
    only visible when css is enabled.  Never seen anything like that.<br>
    <br>
    The css rules are:<br>
    <br>
    display: none;<br>
    visibility: hidden;<br>
    <br>
    This is for css so if the style sheet or styles are disabled then
    you can't use them.<br>
    <br>
    <br>
    <br>
    <blockquote cite="mid:CSS-20191204152601@ram.dialup.fu-berlin.de"
    type="cite">
    <pre wrap="">

    A page element (like a div or p element) is not displayed
    in browsers that do not support CSS or when the access to
    CSS resources is denied.

    But when the browser supports CSS and the CSS resource is
    accessible, then the CSS resource contains rules which then
    will make this element visible.


    </pre>
    </blockquote>
    <br>
    <br>
    <div class="moz-signature">-- <br>
    <div class="moz-signature">
    <div style="width: 340px;height: 290px; background-color: blue;
    color: yellow;font-weight: bolder; font-size:200%; text-align:
    center; margin: 30px 5px 30px 5px;">With over 1,000,000
    million devices now running Windows 10, customer satisfaction
    is higher than any previous version of windows.</div>
    </div>
    </div>
    </body>
    </html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Evertjan.@21:1/5 to Hello.World@example.com on Thu Dec 5 11:37:01 2019
    <Hello.World@example.com> wrote on 05 Dec 2019 in comp.infosystems.www.authoring.stylesheets:

    On 04/12/2019 14:31, Stefan Ram wrote:
    Is there a standard solution to realize the following?

    No there isn't anything like what you want to do because anything on an
    HTML page is visible by default. You can then use css to hide them but there isn't anything that can hide the text by default and only visible
    when css is enabled. Never seen anything like that.

    <style>
    #div1::before {
    content: "This is only readable with css on!";
    }
    </style>

    <div id='div1'><br>This is always readable.</div>

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Philip Herlihy@21:1/5 to All on Mon Jan 6 11:17:13 2020
    In article <qs8sqo$m56$1@dont-email.me>, please@see.Web.for.e-
    mail.INVALID says...

    Stefan Ram wrote:
    Is there a standard solution to realize the following?

    A page element (like a div or p element) is not displayed
    in browsers that do not support CSS or when the access to
    CSS resources is denied.

    But when the browser supports CSS and the CSS resource is
    accessible, then the CSS resource contains rules which then
    will make this element visible.

    Sounds like you want the new "hidden"
    attribute. Visit: https://html.spec.whatwg.org/multipage/interaction.html#the-hidden-attribute

    Never used it myself, so I cannot help you
    further.

    New to me! Good support, it seems:

    https://caniuse.com/#search=hidden

    Otherwise, Evertjan beat me to suggesting use of the ::before pseudo-
    element.



    --

    Phil, London

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)