If you're looking to achieve this functionality in HTML5 without the need for javascript, consider using the Details element. This semantic element allows you to create collapsible sections of content with a simple markup structure.
For more information on how to use the Details element, check out this resource.
Here's an example of how you can implement the Details element in your code:
<details>
<summary>Click here for more info</summary>
<p>This is where you can find all the details you need.</p>
</details>
By utilizing the Details element, you can focus on styling the content rather than writing custom javascript code for similar functionality.