log4code


Use HTML <details/> tag to hide/display content

Documentation is an important part of software development, But sometimes, large blocks of code or steps with multiple, lengthy steps can overtake the main points being made to the reader.

In these situations, try using the HTML <details> tag to allow for content to be initially hidden and expanded if the reader wants to explore the content in-depth.

This <details> tag provides for a summary with an expandable detailed view when clicked. See the example below:

Click to expand Details go here!

The code that just made this work looks like this:

<details>
  <summary>Click to expand</summary>
  The code that just made this work looks like this:
</details>

As of this post, this tag is supported in all major browsers.

See the article from the Mozilla Developer Network (MDN) for more details.