HTML tag does not work in IE/Edge











up vote
3
down vote

favorite












I am trying to add additional toggleable section that user can show and hide.



My requirements:




  • supported on major browsers (Opera, Chrome, Edge, IE11, Firefox, Safari on Mac)

  • no javascript


And was thinking of using the <details> tag, however the code



<details>
<summary>Toggle</summary>
<p>Hideable</p>
</details>


does not work on the Edge / IE browsers.



Can I anyhow "make" it work, or is there anything else I can use for that task? Hacks are OK, as long as no javascript is present.










share|improve this question


















  • 1




    :target or :checked come to mind, if adding the necessary additional elements (a link for the former, or a checkbox + label for the latter) is not a problem. sitepoint.com/css3-vertical-accordion-using-target-selector, geoffgraham.me/css-only-accordion-using-the-checkbox-hack explain the basic principles behind both techniques.
    – CBroe
    Jul 12 at 11:17












  • @CBroe so cool, I wouldn't think of it. My guess is that you should publish it as an answer.
    – wscourge
    Jul 12 at 14:21















up vote
3
down vote

favorite












I am trying to add additional toggleable section that user can show and hide.



My requirements:




  • supported on major browsers (Opera, Chrome, Edge, IE11, Firefox, Safari on Mac)

  • no javascript


And was thinking of using the <details> tag, however the code



<details>
<summary>Toggle</summary>
<p>Hideable</p>
</details>


does not work on the Edge / IE browsers.



Can I anyhow "make" it work, or is there anything else I can use for that task? Hacks are OK, as long as no javascript is present.










share|improve this question


















  • 1




    :target or :checked come to mind, if adding the necessary additional elements (a link for the former, or a checkbox + label for the latter) is not a problem. sitepoint.com/css3-vertical-accordion-using-target-selector, geoffgraham.me/css-only-accordion-using-the-checkbox-hack explain the basic principles behind both techniques.
    – CBroe
    Jul 12 at 11:17












  • @CBroe so cool, I wouldn't think of it. My guess is that you should publish it as an answer.
    – wscourge
    Jul 12 at 14:21













up vote
3
down vote

favorite









up vote
3
down vote

favorite











I am trying to add additional toggleable section that user can show and hide.



My requirements:




  • supported on major browsers (Opera, Chrome, Edge, IE11, Firefox, Safari on Mac)

  • no javascript


And was thinking of using the <details> tag, however the code



<details>
<summary>Toggle</summary>
<p>Hideable</p>
</details>


does not work on the Edge / IE browsers.



Can I anyhow "make" it work, or is there anything else I can use for that task? Hacks are OK, as long as no javascript is present.










share|improve this question













I am trying to add additional toggleable section that user can show and hide.



My requirements:




  • supported on major browsers (Opera, Chrome, Edge, IE11, Firefox, Safari on Mac)

  • no javascript


And was thinking of using the <details> tag, however the code



<details>
<summary>Toggle</summary>
<p>Hideable</p>
</details>


does not work on the Edge / IE browsers.



Can I anyhow "make" it work, or is there anything else I can use for that task? Hacks are OK, as long as no javascript is present.







html html5 internet-explorer microsoft-edge






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 12 at 11:13









Igor Mandzopulos

284




284








  • 1




    :target or :checked come to mind, if adding the necessary additional elements (a link for the former, or a checkbox + label for the latter) is not a problem. sitepoint.com/css3-vertical-accordion-using-target-selector, geoffgraham.me/css-only-accordion-using-the-checkbox-hack explain the basic principles behind both techniques.
    – CBroe
    Jul 12 at 11:17












  • @CBroe so cool, I wouldn't think of it. My guess is that you should publish it as an answer.
    – wscourge
    Jul 12 at 14:21














  • 1




    :target or :checked come to mind, if adding the necessary additional elements (a link for the former, or a checkbox + label for the latter) is not a problem. sitepoint.com/css3-vertical-accordion-using-target-selector, geoffgraham.me/css-only-accordion-using-the-checkbox-hack explain the basic principles behind both techniques.
    – CBroe
    Jul 12 at 11:17












  • @CBroe so cool, I wouldn't think of it. My guess is that you should publish it as an answer.
    – wscourge
    Jul 12 at 14:21








1




1




:target or :checked come to mind, if adding the necessary additional elements (a link for the former, or a checkbox + label for the latter) is not a problem. sitepoint.com/css3-vertical-accordion-using-target-selector, geoffgraham.me/css-only-accordion-using-the-checkbox-hack explain the basic principles behind both techniques.
– CBroe
Jul 12 at 11:17






:target or :checked come to mind, if adding the necessary additional elements (a link for the former, or a checkbox + label for the latter) is not a problem. sitepoint.com/css3-vertical-accordion-using-target-selector, geoffgraham.me/css-only-accordion-using-the-checkbox-hack explain the basic principles behind both techniques.
– CBroe
Jul 12 at 11:17














@CBroe so cool, I wouldn't think of it. My guess is that you should publish it as an answer.
– wscourge
Jul 12 at 14:21




@CBroe so cool, I wouldn't think of it. My guess is that you should publish it as an answer.
– wscourge
Jul 12 at 14:21












2 Answers
2






active

oldest

votes

















up vote
2
down vote













This would be the suggested :checked method utilizing a hidden checkbox:






.toggler {
display: none;
}

.toggler+.toggler-content {
max-height: 0;
opacity: 0;
overflow: hidden;
transition: all .4s ease-in-out;
}

.toggler:checked+.toggler-content {
max-height: 1000px;
opacity: 1;
}

<div>
<label for="toggler-id-1">Toggle</label>
<input type="checkbox" id="toggler-id-1" class="toggler" />
<div class="toggler-content">Hideable</div>
</div>





I would still prefer going with @Finesse's solution because it allows you to use the semantically correct HTML element for the purpose.






share|improve this answer




























    up vote
    2
    down vote













    You can add a polyfill once on a page to make all the <details/>s on the page work:



    <!-- Inside the body -->
    <script src="//cdn.jsdelivr.net/npm/details-polyfill@1/index.min.js" async></script>


    I know this is a JS solution but it doesn't require writing any JS for each individual <details/>. It can be used with a text written in a WYSIWYG editor.






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














       

      draft saved


      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51304178%2fhtml-details-tag-does-not-work-in-ie-edge%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      2
      down vote













      This would be the suggested :checked method utilizing a hidden checkbox:






      .toggler {
      display: none;
      }

      .toggler+.toggler-content {
      max-height: 0;
      opacity: 0;
      overflow: hidden;
      transition: all .4s ease-in-out;
      }

      .toggler:checked+.toggler-content {
      max-height: 1000px;
      opacity: 1;
      }

      <div>
      <label for="toggler-id-1">Toggle</label>
      <input type="checkbox" id="toggler-id-1" class="toggler" />
      <div class="toggler-content">Hideable</div>
      </div>





      I would still prefer going with @Finesse's solution because it allows you to use the semantically correct HTML element for the purpose.






      share|improve this answer

























        up vote
        2
        down vote













        This would be the suggested :checked method utilizing a hidden checkbox:






        .toggler {
        display: none;
        }

        .toggler+.toggler-content {
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        transition: all .4s ease-in-out;
        }

        .toggler:checked+.toggler-content {
        max-height: 1000px;
        opacity: 1;
        }

        <div>
        <label for="toggler-id-1">Toggle</label>
        <input type="checkbox" id="toggler-id-1" class="toggler" />
        <div class="toggler-content">Hideable</div>
        </div>





        I would still prefer going with @Finesse's solution because it allows you to use the semantically correct HTML element for the purpose.






        share|improve this answer























          up vote
          2
          down vote










          up vote
          2
          down vote









          This would be the suggested :checked method utilizing a hidden checkbox:






          .toggler {
          display: none;
          }

          .toggler+.toggler-content {
          max-height: 0;
          opacity: 0;
          overflow: hidden;
          transition: all .4s ease-in-out;
          }

          .toggler:checked+.toggler-content {
          max-height: 1000px;
          opacity: 1;
          }

          <div>
          <label for="toggler-id-1">Toggle</label>
          <input type="checkbox" id="toggler-id-1" class="toggler" />
          <div class="toggler-content">Hideable</div>
          </div>





          I would still prefer going with @Finesse's solution because it allows you to use the semantically correct HTML element for the purpose.






          share|improve this answer












          This would be the suggested :checked method utilizing a hidden checkbox:






          .toggler {
          display: none;
          }

          .toggler+.toggler-content {
          max-height: 0;
          opacity: 0;
          overflow: hidden;
          transition: all .4s ease-in-out;
          }

          .toggler:checked+.toggler-content {
          max-height: 1000px;
          opacity: 1;
          }

          <div>
          <label for="toggler-id-1">Toggle</label>
          <input type="checkbox" id="toggler-id-1" class="toggler" />
          <div class="toggler-content">Hideable</div>
          </div>





          I would still prefer going with @Finesse's solution because it allows you to use the semantically correct HTML element for the purpose.






          .toggler {
          display: none;
          }

          .toggler+.toggler-content {
          max-height: 0;
          opacity: 0;
          overflow: hidden;
          transition: all .4s ease-in-out;
          }

          .toggler:checked+.toggler-content {
          max-height: 1000px;
          opacity: 1;
          }

          <div>
          <label for="toggler-id-1">Toggle</label>
          <input type="checkbox" id="toggler-id-1" class="toggler" />
          <div class="toggler-content">Hideable</div>
          </div>





          .toggler {
          display: none;
          }

          .toggler+.toggler-content {
          max-height: 0;
          opacity: 0;
          overflow: hidden;
          transition: all .4s ease-in-out;
          }

          .toggler:checked+.toggler-content {
          max-height: 1000px;
          opacity: 1;
          }

          <div>
          <label for="toggler-id-1">Toggle</label>
          <input type="checkbox" id="toggler-id-1" class="toggler" />
          <div class="toggler-content">Hideable</div>
          </div>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 2 at 7:42









          connexo

          19.7k73353




          19.7k73353
























              up vote
              2
              down vote













              You can add a polyfill once on a page to make all the <details/>s on the page work:



              <!-- Inside the body -->
              <script src="//cdn.jsdelivr.net/npm/details-polyfill@1/index.min.js" async></script>


              I know this is a JS solution but it doesn't require writing any JS for each individual <details/>. It can be used with a text written in a WYSIWYG editor.






              share|improve this answer



























                up vote
                2
                down vote













                You can add a polyfill once on a page to make all the <details/>s on the page work:



                <!-- Inside the body -->
                <script src="//cdn.jsdelivr.net/npm/details-polyfill@1/index.min.js" async></script>


                I know this is a JS solution but it doesn't require writing any JS for each individual <details/>. It can be used with a text written in a WYSIWYG editor.






                share|improve this answer

























                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  You can add a polyfill once on a page to make all the <details/>s on the page work:



                  <!-- Inside the body -->
                  <script src="//cdn.jsdelivr.net/npm/details-polyfill@1/index.min.js" async></script>


                  I know this is a JS solution but it doesn't require writing any JS for each individual <details/>. It can be used with a text written in a WYSIWYG editor.






                  share|improve this answer














                  You can add a polyfill once on a page to make all the <details/>s on the page work:



                  <!-- Inside the body -->
                  <script src="//cdn.jsdelivr.net/npm/details-polyfill@1/index.min.js" async></script>


                  I know this is a JS solution but it doesn't require writing any JS for each individual <details/>. It can be used with a text written in a WYSIWYG editor.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 10 at 8:43

























                  answered Nov 2 at 6:52









                  Finesse

                  1,98031331




                  1,98031331






























                       

                      draft saved


                      draft discarded



















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51304178%2fhtml-details-tag-does-not-work-in-ie-edge%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Guess what letter conforming each word

                      Port of Spain

                      Run scheduled task as local user group (not BUILTIN)