Site logo

Archived topic

Formatting code text

5 replies · Started by Maynard on January 12, 2021

Viewing posts 1–6 of 6

Hi,

Newbie question. I noticed on this forum that code is published in a nice box and in red -- here is my code.

How can I achieve this within GeneratePress? When I use < code >, the text is monotype without the box.

Would be useful to know how all < code > text on a website can be changed to show the code in this better format.

Any help appreciated.

Hi there,

the Code Block should show you a similar style to what is displayed here.
If it isn't can you share a link to a page where i can see the issue.

Hi
Ok, link in the private info box. Two examples very near the top. Just a skeleton WP site with GeneratePress/Blocks installed. Thanks for helping.

Its working as it should in the Code Block.
For the HTML Block you also need to include the <pre></pre> tags which is where the padding and background colors are applied eg.

<pre><code> in custom html block</code></pre>

Hi,
Sorry, now tried with pre tags for the HTML block and not really getting anywhere :-(

In this forum I see the code tag gives nice red text in a box with a thin border like this.

But on my site I see monotype black text with a grey background. Is this black monotype text what I am expected to see?

That will require some CSS:

pre {
  border-radius: 4px;
  border: 1px solid #ccc;
  color: #f00;
}
This archived topic is closed to new replies.