I mentioned a simple CSS trick to generate full-width figures in 2021. I was thinking the other day if I could make certainly elements automatic, so I do not need to manually specify them to be full-width. Finally, I wrote some JS code to deal with three types of elements automatically:
-
Code blocks (
<pre><code>).If the
scrollWidthis greater thanoffsetWidth, it means the code block has a horizontal …