HTML: collapsing/hiding text
September 6, 2020 5:10 PM   Subscribe

Both my google-fu and my mefi-search-fu are failing me. I've seen other Mefites do a thing in comments that hides text (eg. part of a comment that contains spoilers) until the reader clicks the little triangle arrow. And I'm sure someone has asked about how to do it here before, or someone has provided a how-to that I've read somewhere on the site, and there was just a simple html tag to use? But I can't seem to find it now.

What I have found:
HTML collapsible content
toggle hide/show
tree view

But all of these seem to require also adding in some CSS (and javascript, in some cases?), and I have this vague recollection of reading a comment that described how to do this in a manner that just used a single HTML tag and nothing more. Am I remembering correctly, and is there an easier method?

If not, and the three options above are my only options, what are the pros and cons or intended use cases of each?

My context, in case it makes a difference to the answer, is creating a "page" in Moodle, which is done using Moodle's HTML editor. So I can input my own hand-coded html instead of using their GUI buttons, and I gather Moodle treats my content as a block within an html page that it automatically creates header data for. But I'm not sure if adding my own CSS code will work? Also, my HTML skills are circa HTML2, before CSS was a thing, and I know that I can do some copy-paste-edit and figure out one of the above three options, but that will take time that I'd rather spend on other class prep tasks if I can.
posted by eviemath to Computers & Internet (2 answers total) 3 users marked this as a favorite
 
Best answer: It's the <summary> tag, first discussed here I think. Here's an explanation of how to use it. And don't miss jedicus's awesome Choose-Your-Own Adventure.
posted by Rhaomi at 5:22 PM on September 6, 2020 [2 favorites]


I'm sure it came up earlier than that. The drawback was that it didn't work cross-platform as well as one would wish. Various mobile browsers and such didn't support it. Such is HTML.
posted by zengargoyle at 8:53 PM on September 6, 2020 [1 favorite]


« Older A question about real estate and mortgages in...   |   Do I need to discard a fridge that has had rotted... Newer »
This thread is closed to new comments.