DEV Community

⚫️ nothingness negates itself
⚫️ nothingness negates itself

Posted on

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)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay