Marking up code examples

 I now put code examples inside a '<pre><code>' block


I was using '&nbsp;' to indent lines.


I set the '<code>' to 'display:block' so I can indent it with 'margin-left'.


I start the example code immediately after the '<code>' tag to avoid an extra newline.


I put everything in a 'div' with contenteditable="true" and  spellcheck="false" to allow 'copy and pasting' and to remove any red 'spell-check' wavy line.


I give the 'div' 'max-width:100%' and 'overflow:auto' to stop scrollbars appearing in the browser's outer window


There are more tips at: [bbingo.xyz/t](http://bbingo.xyz/t)


There are more tips at: bbingo.xyz/techtips/




Comments

Popular posts from this blog

Steve Jobs quotes

Dark mode using 'invert' does not work on Firefox

U.S. government uses internet backdoors for surveillance