# Is there a way to make a section of a post “collapsible”?

You know how some webpages will have a section that looks like > 'heading'; and when you click on it, it expands into a wall of text?

Is there a way to include one of those in post?

There are times when a long explanation is helpful but not strictly necessary, and I don't want to inconvenience people who don't actually need to read it. It would be nice to have an "expand for complete explanation/proof/etc."

I apologize for not knowing what "that thing" is called (I keep wanting to say "drop-down" or "expandable list", but I don't think that's it).

• I don't know if this feature exists, but one thing you can do - which I've done frequently in the past - is to open with the "heading-only" version of the question, then have a line ("******"), then below the line have the additional detail. – Noah Schweber Jul 31 at 16:03
• No, there is no such functionality. – davidlowryduda Jul 31 at 16:56
• Related post on Meta Stack Exchange: Please add the ability to fold blocks of code in questions and answers. (It is marked as status-declined.) And also: How to create a collapsable field in a post. – Martin Sleziak Jul 31 at 18:31
• math.meta.stackexchange.com/questions/30240/… is semi related – Roddy MacPhee Jul 31 at 23:36
• In most writing contexts (including this one), you will not have the option of collapsible sections, so even if this site supported it, you should take this as an opportunity to hone your writing via judicious use of headings, good paragraph structure, and good topic sentences. If you make it easy to find where to skip to next, then this collapsible section should not be necessary. You can provide a short overview of the whole answer, if you think that overview alone will suffice for many people. – Derek Elkins Aug 1 at 1:58
• You may want to organize such extras in footnotes or appendices ... – Hagen von Eitzen Aug 2 at 11:42
• – Paramanand Singh Aug 3 at 9:37

To reiterate what was said in a comment, that's not really possible, except in a way on mobile.

It is possible though to hide text as a spoiler. Like this (hover over it to show, click to fix it, on mobile one has to click but this is even indicated).

This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it. This text is not necessary. Thus we hide it.

The syntax is >! Text

That is sometimes used, but it is not really convenient as it takes up the full space on the site in standard view. However, on the mobile site it seems to be collapsed.

Possibly somebody could use MathJax in a clever way to about what you want. But that would be inconvenient and would have other drawbacks.

What I recommend instead is to format your posts in a good way. If it is really long, write a brief introduction, etc. There are various types of heading and ways to add emphasis. Judicious use of those will allow to present long post in a readable way.

• I've seen an expandible spoiler used before on math stack. – Roddy MacPhee Jul 31 at 17:33
• I just realize that on mobile spoiler collapse. Maybe it was on a mobile? – quid Jul 31 at 23:02
• definitely, haven't had a PC working in 2 years( except a library PC) – Roddy MacPhee Jul 31 at 23:14
• all it would take is inversing the sign on a raise command and undoing a phantom or visibility setting on click. – Roddy MacPhee Jul 31 at 23:21
• if we could toggle easily ( couldn't find the wikibook section for LaTeX equivalent) I found out \let\hphantom\relax \let\vphantom\relax on the TeX exchange. toggle it with conditional on click and protect fragile commands and it would work. – Roddy MacPhee Aug 1 at 1:13

Maybe not what you are really looking for. But you can put 4 spaces before a paragraph

LongExplanationLongExplanationLongExplanationLongExplanationLongExplanationLongExplanationLongExplanationLongExplanationLongExplanationLongExplanationLongExplanationLongExplanationLongExplanationLongExplanationLongExplanationLongExplanationLongExplanation


which adds a horizontal scroll bar to the text so that it doesn't take up too much space of the page. But it would make it annoying for those who wish to read it. So I suggest using newlines carefully to adjust how long horizontally you can scroll and how long vertially it expands.

• Once you do that, the formatting changes to Markdown. It's not always suitable given Math.SE frequently requires MathJax. – TheSimpliFire Aug 1 at 19:50
• Note this may cause screen readers to read the text out letter by letter, because it's intended for source code. – Kevin Aug 7 at 17:48