Code Tag Vs Pre Tag

I wanted to post this while I remembered. I had some weird stuff going while trying to post a code sample in a post on my blog. The code wasn’t wrapped or formatted. I didn’t think anything of it as I just used WordPress’ built-in ‘code’ button that is present in the editor while writing a post. This didn’t work well because none of the code was indented or formatted. I found that if you wrap the “code” tags in a “pre” tag then everything looks good!

As always leave a comment if you have constructive feedback or advice!

Don Marges

Don Marges

Fullstack Web Developer

comments powered by Disqus
rss facebook twitter github youtube mail spotify instagram linkedin