Nowadays we can do that without JavaScript nor CSS by using a Browsers Popover API.
I am so happy to answer that question!
<button popovertarget="mypopover">Toggle the popover</button>
<div id="mypopover" popover>Popover content</div>
references: