Here is my use case, I have a code snippet that I would like a customer to be able to copy and paste for use in their website.
Is there a recommendation on how to have this code display on a page, I also would like to include a button or easy way for the customer to copy the code to the clipboard.
Hello,
You can use the <pre> tags to display code content on your page.
Example:
<pre>
<code><p>Sample text here...</p>
<p>And another line of sample text here...</p>
</code>
</pre>
results in:
<p>Sample text here...</p>
<p>And another line of sample text here...</p>
With Bootsrtap 4 you can optionally add the .pre-scrollable class, which will set a max-height of 340px and provide a y-axis scrollbar.
As for the copy to clipboard option, you can either write the code yourself - there are many tutorials out there providing custom js code for this or use a library like: https://clipboardjs.com/