DEV Community

Answer: How to use code blocks in HTML

why not re-style <code> with that class name instead of introducing <div>-itis 🚬😐?

You probably want to do it in cascading style sheets (CSS). Create some CSS with the look you want, and things marked as <code> should take on that appearance. For example:

<html>
<head>
<style type="text/css">
code { background-color: gray; color: blue; }
</style>
</head>
<body>
<p>Some code:</p>
<code>My
…

Top comments (0)